var search = new Ext.form.ComboBox({
store: ds,
displayField:'title',
typeAhead: false,
loadingText: '搜索中...',
width: 215,
minChars: 1,
pageSize:10,
hideTrigger:false,
tpl: resultTpl,
minChars:1,
emptyText:'请输入需要的搜索......',
onEmptyResults:function(){
this.innerList.update('<div class="loading-indicator">没有信息与您搜索的关键字匹配!</div>')
},
onSelect: function(record){
var str = CheckBegin(record.id)
if(CT.treeCodeTable.getNodeById(str).isExpanded()){
var node = CT.treeCodeTable.getNodeById(record.id)
a = node.fireEvent('click',node)
searchdata.setDisabled(false)
}else{
CT.treeCodeTable.getRootNode().collapseChildNodes()
CT.treeCodeTable.getNodeById(str).expand(true,true,function(){
var node = CT.treeCodeTable.getNodeById(record.id)
a = node.fireEvent('click',node)
searchdata.setDisabled(false)
})
}
this.collapse()
}
});
为了实现该控件的搜索功能以及对查询若不存在情况下的返回,我尝试重写了onEmptyResults属性,从而达到了我所要的功能.