2

我不明白为什么使用 Xtemplate 组合框中的项目不再可选择。我可以在 html 代码中看到这些项目没有更多的 internalId。这是我的代码:

Ext.define('app.widget.search.PredictiveInput', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.predictiveinput',

store: 'SearchSyntax',
storeCriteriaSyntax: 'SearchPredictiveInput',
nodeField: 'is_node',
leafField: 'is_leaf',
lastLeafField: 'is_last_leaf',
levelField: 'level',
triggerAction: 'all',
flex: 1,
queryMode: 'local',
displayField: 'subject_display',
valueField: 'id',
pageSize: 10,

setCustomTpl: function() {
var me = this;
me.tpl = Ext.create('Ext.XTemplate',
'<tpl for=".">',
' <div class="x-combo-list-item-isNode-{nodeField}' + 
' x-combo-list-item-isLeaf-{leafField}' + 
' x-combo-list-item-isLastLeaf-{lastLeafField}' +
' x-combo-list-item-level-{levelField}" role="option">{displayField</div>', 
'</tpl>'           
);
},

initComponent: function() {
this.callParent();
this.setCustomTpl();
}
});
4

1 回答 1

2

我认为您必须添加课程x-boundlist-item

请参阅此处的评论

// Template for the dropdown menu.
// Note the use of "x-boundlist-item" class,
// this is required to make the items selectable.
tpl: Ext.create('Ext.XTemplate',
    '<tpl for=".">',
        '<div class="x-boundlist-item">{abbr} - {name}</div>',
        '</tpl>'
    ),
于 2012-09-20T12:47:06.430 回答