ExtJS listConfig 在项目选择器中不起作用
ExtJS listConfig doesn't work in itemselector
Config listConfig
在 itemselector
组件中不起作用。我想为里面的项目更改 class。
我的代码:
{
xtype: 'itemselector',
name: 'itemselector',
allowBlank: false,
fieldLabel: 'ItemSelector',
displayField: 'text',
store: ds,
valueField: 'value',
value: ['3', '4', '6'],
listConfig: {
itemCls: 'my-class'
},
anchor: '100%',
msgTarget: 'side'
}
这是一个老问题,为了让listConfig起作用,你需要覆盖itemSelector中的create list函数并添加listConfig,像这样:
Ext.override(Ext.ux.form.ItemSelector, {
createList: function(title){
var me = this;
return Ext.create('Ext.ux.form.MultiSelect', {
// We don't want the multiselects themselves to act like fields,
// so override these methods to prevent them from including
// any of their values
submitValue: false,
getSubmitData: function(){
return null;
},
getModelData: function(){
return null;
},
flex: 1,
dragGroup: me.ddGroup,
dropGroup: me.ddGroup,
title: title,
store: {
model: me.store.model,
data: []
},
displayField: me.displayField,
valueField: me.valueField,
disabled: me.disabled,
//Add this config =================
listConfig: me.listConfig,
//=================================
listeners: {
boundList: {
scope: me,
itemdblclick: me.onItemDblClick,
drop: me.syncValue
}
}
});
}
});
Config listConfig
在 itemselector
组件中不起作用。我想为里面的项目更改 class。
我的代码:
{
xtype: 'itemselector',
name: 'itemselector',
allowBlank: false,
fieldLabel: 'ItemSelector',
displayField: 'text',
store: ds,
valueField: 'value',
value: ['3', '4', '6'],
listConfig: {
itemCls: 'my-class'
},
anchor: '100%',
msgTarget: 'side'
}
这是一个老问题,为了让listConfig起作用,你需要覆盖itemSelector中的create list函数并添加listConfig,像这样:
Ext.override(Ext.ux.form.ItemSelector, {
createList: function(title){
var me = this;
return Ext.create('Ext.ux.form.MultiSelect', {
// We don't want the multiselects themselves to act like fields,
// so override these methods to prevent them from including
// any of their values
submitValue: false,
getSubmitData: function(){
return null;
},
getModelData: function(){
return null;
},
flex: 1,
dragGroup: me.ddGroup,
dropGroup: me.ddGroup,
title: title,
store: {
model: me.store.model,
data: []
},
displayField: me.displayField,
valueField: me.valueField,
disabled: me.disabled,
//Add this config =================
listConfig: me.listConfig,
//=================================
listeners: {
boundList: {
scope: me,
itemdblclick: me.onItemDblClick,
drop: me.syncValue
}
}
});
}
});