2014-09-22 50 views
0

我在键入过滤comboxbox时出现问题,当我键入所需的值时,组合突出显示正确的值,但它不会过滤存储。即使在组合框中输入文本后,商店也会重新加载到原始数据。Extjs Combobox存储没有过滤键入的值

这是我的商店代码。

Ext.define('Dashboard.store.Rule', { 
     extend: 'Ext.data.Store', 
     model: 'Dashboard.model.Rule', 
     storeId : 'Rule', 
     pageSize: 35, 
     autoSync : false, 
     autoLoad: true, 
     remoteFilter: true, 
     sorters : ['ruleName'], 
     proxy: { 
      type: 'ajax', 
      api: { 
        read : 'rule/view.action', 
        create : 'rule/create.action', 
        update: 'rule/update.action', 
        destroy: '' 
      }, 
      reader: {     //reads the data in the JSON Format 
        type: 'json', 
        root: 'data', 
        successProperty: 'success' 
      }, 
      writer: { 
         type: 'json',   //writes the data in the JSON Format 
         writeAllFields: true, 
         encode: true, 
         root: 'data' 
      }, 
      listeners: {    //Exception Handler for the Ajax Request 
         exception: function(proxy, response, operation){ 

         var error = Ext.decode(response.responseText); 
         Ext.MessageBox.show({ 
            title: 'REMOTE EXCEPTION', 
            msg: error.message, 
            icon: Ext.MessageBox.ERROR, 
            buttons: Ext.Msg.OK 

         }); 
        } 
       } 
     } 
    }); 

及以下考虑

xtype: 'combobox', 
    id : 'ruleName', 
    padding : '10 30 10 20', 
    fieldLabel: '<html><font color = "red">*</font></html>Rule Name', 
    store: 'Rule',  
    width: screen.width*0.22, 
    emptyText: 'Select Rule', 
    typeAhead : true, 
    allowBlank: false, 
    queryMode: 'remote', 
    lastQuery:'', 
    displayField: 'ruleName', 
    disabled : true, 
    maxLength: 100, 
    maxLengthText: 'Maximum text size allowed 100', 
    listeners : { 
      'change' : function(){ 
          //TODO 
      }, 
      'blur' : function(){ 
         //TODO 
      } 

    } 

我也试图把triggerAction : 'all'但仍没有工作我的组合框代码。

请在这个问题上帮助

非常感谢

+0

由于您已激活remoteFilter,因此您的过滤器应位于服务器上。我猜你没有在服务器上实现任何过滤器,对吧? – Alexander 2014-09-22 07:49:38

+0

是的亚历山大我没有实现remoteFilter,但onload我带来了所有的数据从服务器。但我不明白为什么它会对我输入的每个字符发起ajax请求。我是否缺少这种情况下必需的配置属性。请帮助.. – 2014-09-22 08:33:56

+0

您明确告诉他**通过陈述'remoteFilter:true'来使用这种行为。 – Alexander 2014-09-22 08:39:15

回答

2

你的店配置了

remoteFilter: true, 

告诉店重装当这个filter被改变,发送过滤器配置到服务器,所以可以应用服务器端过滤器。

由服务器发回的记录不会被客户端过滤,因为服务器应该已经这样做了。

您是否实现了过滤器服务器端?如果是这样,那么你的过滤代码是什么?

如果您不打算过滤服务器端,请将remoteFilter设置为false。