Extjs4-boxselect';显示字段问题
我在extjs4中工作。我有一个附带商店的组合框Extjs4-boxselect';显示字段问题,extjs4,Extjs4,我在extjs4中工作。我有一个附带商店的组合框 var store=Ext.create('ListStore',{ model: 'ListModel', autoLoad:false, pageSize: 0 }); 我已将此商店绑定到boxselectas= xtype: 'boxselect', height: 30,
var store=Ext.create('ListStore',{
model: 'ListModel',
autoLoad:false,
pageSize: 0
});
我已将此商店绑定到boxselectas=
xtype: 'boxselect',
height: 30,
store:store,
allowBlank: false,
displayField: 'name',
我有一个以字段为单位的模型=
{name: 'projectNumber', type: 'int'},
{name: 'name', type: 'string'},
我想将组合框文本显示为=“name-”。那么如何根据需要将displayfield添加到boxselect?我不知道什么是
xtype:'boxselect'
,但是对于xtype:'combo'
您可以使用tpl
属性:
xtype: 'boxselect',
height: 30,
store:store,
allowBlank: false,
displayField: 'name',
//...
tpl: new Ext.XTemplate('<tpl for="."><div class="x-boundlist-item" >{name} - {projectNumber}</div></tpl>'),
displayTpl: new Ext.XTemplate('<tpl for=".">{name} - {projectNumber}</tpl>')
xtype:'boxselect',
身高:30,
店:店,,
allowBlank:false,
displayField:'名称',
//...
tpl:new Ext.XTemplate(“{name}-{projectNumber}”),
displayTpl:new Ext.XTemplate(“{name}-{projectNumber}”)
以下是JSFIDLE中的一个示例: