0

我面临组合自动完成问题的问题:1)它没有在用户提前输入时过滤搜索 2)我观察到(在萤火虫中)每次我输入一个字母时,它都会通过休息调用获取结果。任何指针都会有所帮助... 代码:型号----------

Ext.define('TopoApplication.model.MDeviceDetail', {
extend: 'Ext.data.Model',
fields: [
{
name: 'deviceName',
mapping: 'name'
},
{
name: 'id',
mapping: 'id'
},
{
name: 'deviceType',
mapping: 'deviceType'
},
{
name: 'longname',
mapping: 'longname'
},
{
name: 'state',
mapping: 'state'
}

],
proxy: {
type : 'rest',
extraParams: {
test:'2'
},
url :'topo/message',
// format: 'json',
reader: {
type:'json',
root : 'devicelist'
}

}

});

店铺:

Ext.define('TopoApplication.store.SDeviceDetail', {
extend : 'Ext.data.Store',
model : 'TopoApplication.model.MDeviceDetail',
autoLoad: true
});

看法: - - - - - - - - - - - - - - - - -

var combo = {
xtype : 'combo',
fieldLabel : 'Search By Device Name',
forceSelection : true,
valueField : 'id',
displayField : 'deviceName',
typeAhead : true,
hideTrigger: true,
loadingText : 'Querying....',
// pageSize : 20,
minChars : 1,
triggerAction : 'all',
//itemSelector : 'div.search-item',
store : 'SDeviceDetail',
listeners: {
'select': {fn:function(){console.log(this.getValue());}}
}
};

Ext.define('TopoApplication.view.device.DeviceDetail', {

extend : 'Ext.window.Window',
title : 'Device Detail Information',
width : 500,
height : 620,
alias : 'widget.deviceDetail',
defaults : {
bodyStyle : 'padding:15px'
},
items : combo,
initComponent : function() {
console.log('initComponent: DeviceDetail Window');
this.viewConfig = {
forceFit : true
};
this.callParent(arguments);
this.show();
}
});

控制器: - - - - - - - - - - - -

Ext.define('TopoApplication.controller.CDeviceDetail', {
extend : 'Ext.app.Controller',
stores : ['SDeviceDetail'],
models : ['MDeviceDetail'],
views : ['device.DeviceDetail'],
// views : ['device.Grid'],
init : function() {
// When we declare stores and models, the controller will automatically create getter functions for them.
// this.getSDeviceDetailStore().load();

this.control({
'viewport>panel' : {
render : this.onPanelRendered
}
});
console.log('Initialized CDeviceDetail Controller');
},

onPanelRendered : function() {
console.log('The panel was rendered');
}

});

提前致谢。

阿米特

4

1 回答 1

1

只需将“查询模式:本地”添加到组合框配置即可解决此问题。

于 2012-12-14T15:18:52.627 回答