form表单中有一项,要从Base_Customer表中取出客户ID及客户名称:
双击或点击“修改&查看”,弹出以下页面:
我所希望的是“客户名称”应该显示Customer,而不是显示AutoID。
原因是因为在声明数据源dsCustomerName时少些了一句:dsCustomerName.load();只要加上了这一句,在查看时显示的就是客户名称,而不是客户ID。
具体实例如下:
{
xtype :"combo",
id :'cmb_customername_value',
hiddenName : 'CustomerName',
store:dsCustomerName,
valueField :'AutoID',
displayField :'CustomerName',
fieldLabel :"客户名称",
emptyText :'请选择客户',
triggerAction :'all',
selectOnFocus :true ,
width:100
}
var dsCustomerName = new Ext.data.JsonStore( {
url :'CustomerListData.jsp?DbType=Combo',
totalProperty :'count',
root :'members',
waitTitle :'请稍等。。。',
emptyText :'没有数据!',
fields : [ {
name :'AutoID'
},{
name:'CustomerName'
}],
sortInfo : {
field :'AutoID',
direction :'ASC'
},
remoteSort :true
});
dsCustomerName.load();