2014-11-10 3 views
0

데이터 형식이 해시 배열로되어 있습니다. 3 개의 필드는 id, value 및 production_group_id입니다. 이제는 레코드의 production_group_id를 기준으로 필터 콤보 상자를 만들고 싶습니다.ExtJs에서 로컬 레코드를 필터링 할 수 없습니다.

기본적으로 저장소에 초기 채워진 데이터가 있습니다. 필드를 필터링하고 싶습니다. 어떻게 든 리스너가 작동하지 않습니다. 당신이 (Ext.form.ComboBox 포함) 필드를 사용하는 경우

Ext.define('fabmin.view.ComboColumn', { 
    extend: 'Ext.grid.column.Column', 
    alias: 'widget.comboboxcolumn', 
    width: 100, 
    isEditable: true, 
    list: [], // list = [{id: 'id1', value: 'value1', production_group_id: 'production_group_id1 }, {id: 'id1', value: 'value1', production_group_id: 'production_group_id1 }] 
    initComponent: function(){ 
     var me = this, 
      list = me.list || []; 

     if(me.isEditable){ 
      me.editor = Ext.create('Ext.form.ComboBox',{ 
       forceSelection: true, 
       typeAhead: true, 
       queryMode: 'local', 
       displayField: 'value', 
       valueField: 'id', 
       store: Ext.create('Ext.data.ArrayStore', { 
        fields: ['id', 'value','production_group_id'], 
        data: list 
       }), 
       allowBlank: false, 
       listeners: { 
        click: function (v, p, record, rowIndex, colIndex, store, view) { 
         debugger 
         var newdata = [];; 
         for (i = 0; i < me.store.length; i++) { 
          if (me.store[i].production_group_id == record.production_group_id){ 
           newdata.push(me.store[i]) 
          } 
         } 
         debugger 
         me.store.load(newdata); 
        }, 
        scope: me 
       } 
      }); 
     } 

     me.renderer = function(v, p, record, rowIndex, colIndex, store, view) { 
      var len = list.length, 
       currOpt; 
      while(len--) { 
       currOpt = list[ len ]; 
       if (v == currOpt.id) { 
        return currOpt.value; 
       } 
      } 
      return v; 
     } 
     me.callParent(arguments); 
    } 
}); 

답변

0

는 당신은 change 이벤트를 수신합니다. 필드에서 값이 변경된 후 해고됩니다. 목록에서 항목을 선택할 때도 마찬가지입니다.

관련 문제