基于存储数据的带有图标和文本的ExtJS组合框列表
我有一个基于存储数据的带有图标和文本的ExtJS组合框列表,extjs,combobox,store,extjs5,Extjs,Combobox,Store,Extjs5,我有一个组合框,它从一家商店输入iconCLS的信息和文本 我希望它同时显示图标和文本,如示例所示 我可以将它们添加到下拉列表中,但选择一个值后,图标消失 这是我的密码: CSS: 分机: 组合框模型: Ext.define('Processes.customerInfo.model.ComboBox', { extend: 'Ext.data.Model', fields: [ {name: 'id', type: 'string'}, {name: 'name
组合框
,它从一家商店输入iconCLS
的信息和文本
我希望它同时显示图标和文本,如示例所示
我可以将它们添加到下拉列表中,但选择一个值后,图标消失
这是我的密码:
CSS:
分机:
组合框模型:
Ext.define('Processes.customerInfo.model.ComboBox', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'}
]
});
谁能给我一些帮助吗
注意:我必须通过cls“客户信息子选择器黄金图标”插入图标
就快到了,只需使用(Ext.view.BoundListView
是xtype:'combo'
)配置的选择器,而不是像这样:
listConfig: {
tpl: '<tpl for="."><div class="{x-boundlist-item}"><img src="{icon}" class="icon"/>{name}</div></tpl>'
}
listConfig:{
tpl:“{name}”
}
另外,还可以阅读关于一般使用的。那么,我是否应该在组合框上使用afterRender调用该方法?是的,您可以在
afterRender
事件处理程序中执行。
Ext.define('Components.contacts.contactComponent.store.ChooserStore', {
extend: 'Ext.data.Store',
model: 'Processes.customerInfo.model.ComboBox',
autoDestroy: true,
proxy: "memory",
data: [
{id: 'sub-chooser-gold-icon', name: "Chooser"},
{id: 'sub-chooser-grey-icon', name: "Sub-chooser"}
]
});
Ext.define('Processes.customerInfo.model.ComboBox', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'}
]
});
listConfig: {
tpl: '<tpl for="."><div class="{x-boundlist-item}"><img src="{icon}" class="icon"/>{name}</div></tpl>'
}