Seb*_*ian 2 javascript extjs extjs4
我想用Combobox斜体做一些我的参赛作品.
是否有类似于Column的渲染器或者我如何能够实现这一点?
编辑:对不起,但我没有提供足够的信息,我意识到这是废话我之前想做的...
在完全理解我的问题之后,我会写更多的话来...
如果您只想为列表项本身设置样式,getInnerTpl()则为下拉列表中使用的内部绑定列表提供一个函数就足够了:
var combo = new Ext.form.field.ComboBox({
// ...
listConfig: {
getInnerTpl: function() {
return '{field1}: {field2}';
}
},
// ...
});
Run Code Online (Sandbox Code Playgroud)
如果您想要更改下拉列表的整个内容,请在以下位置提供tpl参数listConfig:
var combo = new Ext.form.field.ComboBox({
// ...
listConfig: {
tpl: '<div><tpl for="."><span class="item">{field1}: {field2}</span></tpl></div>',
itemSelector: 'span.item' // you need to provide an itemSelector if you change the template
},
// ...
});
Run Code Online (Sandbox Code Playgroud)
正如TanelTähepõld所建议的那样,你应该阅读文档Ext.XTemplate.