2013-12-17 4 views
0

я получил сетку с удаленным хранилищем,
Я хочу, чтобы применить фильтр на сетке,
при проверке Chrome консоли оказывается есть:ExtJS 4 сетки локальной фильтрация не работает

this.filters <RETURN> 

    i { ftype: "filters", local: true, filters: i, 
       deferredUpdate: Ext.util.DelayedTask, filterConfigs: Array[1]…} 
     deferredUpdate: Ext.util.DelayedTask 
     filterConfigs: Array[1] 
      0: Object 
       dataIndex: "offercount" 
       type: "numeric" 
     ... 

Но без фильтра в Доступна сетевая сетка extjs.
Это код для сетки:

{ xtype:'grid', id: 'Grid121', list_id:'121', 
    store: {xtype:'store', 
     id:'Store121', 
     autoLoad: {start: 0, limit: 20}, 
     fields:[ 
      {name: 'url', type: 'String' }, 
      {name: 'offercount', type: 'int' }, 
      {name: 'plattform'},], 
     pageSize: 20, 
     groupField: '', 
     remoteSort:true, remoteFilter :true, remoteGroup :true, 
     proxy: { 
      type: 'ajax', 
      url: absolutePath +'AJAXRequest/Object/121/GetData/', 
      reader: { type: 'json',root: 'rows',totalProperty: 'results'}, 
      writer_url: absolutePath +'AJAXRequest/Object/121/SetData/', 
     }, 
     filters: [ 
      {property: 'searchstring',value : ''}, 
      {property: 'searchtype',value : 0}, 
     ], 
     listeners: 
      {update: function(store,record, operation,modifiedFieldNames, eOpts){ 
        if(operation==Ext.data.Model.EDIT) 
         submitRow(record,modifiedFieldNames); 
       }, 
      }, 
    }, 
    columns: [ 
      {xtype: 'rownumberer', header:'Pos.',width:40}, 
      { header: 'URL', dataIndex: 'url', sortable: true, filterable: true, width:217, autoSize: true, }, 
      { header: 'Angebote', dataIndex: 'offercount', sortable: true, filterable: true,minWidth:80, autoSizeColumn: true, }, 
      { header: 'Plattform', dataIndex: 'plattform', sortable: true, filterable: true,minWidth:80, autoSizeColumn: true, }, 
      { xtype:'actioncolumn', width:40, tdCls:'editRow', items:[ { handler: function(gridview, rowIndex, colIndex){grid =gridview.up('panel');var editor = grid.getPlugin(); var rec = gridview.getStore().getAt(rowIndex);editor.startEdit(rec,grid.columns[colIndex]); } } ] } 
    ], 
    selModel:{ 
     mode:"SIMPLE",listeners:{ 
      selectionchange:function (selection, selected, eOpts){ 
       checkListDelete(selection, selected, eOpts);   
      } 
     } 
    }, 
    viewConfig: { 
     enableTextSelection: true, 
    }, 
    features: [{ 
     ftype: 'filters', local: true, filters: [ 
      { type: 'numeric', 
       dataIndex: 'offercount' 
      }, 
     ], 
    },], 
    plugins: [{ptype: 'rowediting',clicksToMoveEditor: 1,autoCancel: false,clicksToEdit :2},], 
    listeners: { 
     columnhide: function (ct, column, fromIdx, toIdx, eOpts){listColumnHide(ct, column, eOpts);}, 
     columnshow: function (ct, column, fromIdx, toIdx, eOpts){listColumnShow(ct, column, eOpts);}, 
     columnmove: function (ct, column, fromIdx, toIdx, eOpts){listColumnMoved(ct,column,fromIdx, toIdx);}, 
     columnresize: function(ct, column, width, eOpts){listColumnResized(ct,column,width);}, 
     itemdblclick: function (view,record,item,index,event,eventOptions){ 
      null 
     }, 
    }, 
    dockedItems: [ 
     {xtype: 'pagingtoolbar',store:'Store121', id: 'pagingtoolbar121', dock: 'top', displayInfo: true, plugins: new Ext.ux.ProgressBarPager()}, 

    ] 
} 

И включены сценарии:

<script > 
Ext.require([ 
    '/System.List', 
    'Ext.ux.grid.*', 
    'Ext.ux.grid.FiltersFeature' 
]); 
</script> 

Я ищу с тех пор одной недели для решения, но я просто не понимаю ...

ответ

0

Пробуйте следующее:

var filters = { 
    ftype: 'filters', 
    // encode and local configuration options defined previously for easier reuse 
    encode: false, // json encode the filter query 
    local: true, // defaults to false (remote filtering) 

    // Filters are most naturally placed in the column definition, but can also be 
    // added here. 
    filters: [ 
     { 
      type: 'boolean', 
      dataIndex: 'visible' 
     } 
    ] 
}; 

var myGrid = new Ext.create('Ext.ux.LiveSearchGridPanel', { 
    selType: 'cellmodel', 
    store: store, 
    ... 
    columns:[ 
     { 
      header: "Header", 
      width: 90, 
      sortable: true, 
      dataIndex: 'INDEX', 
      filterable: true, //<--- 
      filter:{ 
       type:'string' //<--- 
      } 
     } 
     ... 
     features: [filters] //<--- 
}); 
Смежные вопросы