5

因为 ExtJS 4.2 在缓冲网格(无限网格)上使用过滤器似乎有一个错误,所以我重写了我的代码,现在我只是使用一个简单的搜索字段让用户搜索整个网格的数据。只要找到某些东西,它就可以完美运行,但是如果没有找到任何东西,则 ext 会崩溃,但“页面地图要求提供它没有的范围”除外

我的javascript“包括”

<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/Filter.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/BooleanFilter.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/DateFilter.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/ListFilter.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/NumericFilter.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/filter/StringFilter.js"></script>


<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/menu/ListMenu.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/menu/RangeMenu.js"></script>


<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/FiltersFeature.js"></script>
<script type="text/javascript" src="/js/ext-4.2.0.663/examples/ux/grid/TransformGrid.js"></script>


<script type="text/javascript" src="/ASDB4/js/ext-4.2.0.663/examples/ux/form/SearchField.js"></script>

我的商店:

this._store = Ext.create('Ext.data.Store', {
     storeId: 'ActivityLogStore',
     model: 'ActivityLogModel',
     remoteGroup: true,
     autoDestroy: true,
     buffered: true,
     remoteSort: true,
     leadingBufferZone: 300,
     pageSize: 100,
     autoLoad: true,
     proxy: {
         type: 'ajax',
         url: '~myurl~',
         reader: {
             root: 'data[0].sActivityLogsArr',
             totalProperty: 'data[0].totalcount'
         },
         simpleSortMode: true,
         simpleGroupMode: true,
         groupParam: 'sort',
         groupDirectionParam: 'dir',
         filterParam: 'searchString',
         encodeFilters: function (filters) {
             return filters[0].value;
         }
     },
     listeners: {


         // This particular service cannot sort on more than one field, so if grouped, disable sorting
         groupchange: function (store, groupers) {
             var sortable = !store.isGrouped(),
                 headers = grid.headerCt.getVisibleGridColumns(),
                 i, len = headers.length;


             for (i = 0; i < len; i++) {
                 headers[i].sortable = (headers[i].sortable !== undefined) ? headers[i].sortable : sortable;
             }
         },


         beforeload: function () {
             // remove any selections - otherwise store loading crashes (another bug in extjs ...?)
             Ext.getCmp('activityLogmanagergrid').getSelectionModel().clearSelections();
         },


         // This particular service cannot sort on more than one field, so if grouped, disable sorting
         beforeprefetch: function (store, operation) {
             if (operation.groupers && operation.groupers.length) {
                 delete operation.sorters;
             }
         },


         load: function () {
             Ext.getCmp('activityLogmanagergrid').verticalScroller.scrollTo(0);
         }
     }
 });  

我的搜索栏,位于工具栏:

 this._moduleToolbar = {
     xtype: 'toolbar',
     itemId: 'activityLogmanagerToolbar',
     items: [{
             iconCls: 'icon-arrow_refresh',
             text: '@menu_reload@',
             itemId: 'btnReload',
             scope: this,
             handler: function () {
                 // reset list display to top to avoid corrupted display
                 Ext.getCmp('activityLogmanagergrid').store.load();
             }
         }, {
             iconCls: 'icon-cross',
             text: '@menu_deleteAllActivityLog@',
             itemId: 'btnDeleteAll',
             scope: this,
             handler: this.DeleteAllActivityLog
         }, '->', {
             width: 300,
             fieldLabel: 'Search',
             labelWidth: 50,
             xtype: 'searchfield',
             store: scope._store
         }
     ]
 }; 

请帮忙 ...

4

1 回答 1

2

我也有这个问题。我发布到他们的论坛(和其他人一样)并打开了一张支持票。他们没有为 Ext JS 4.2 提出解决方案,但该错误(以及缓冲存储中的许多其他错误)在 4.2.1 版本中得到了修复。我认为那里几乎重建了大部分代码,所以他们没有选择对 4.2 进行廉价修补程序。

在我可以迁移到 4.2.1 之前,我用 try-catch 块包装了我所有的 find-record-calls。我还尝试在第 3383 行覆盖 Store.js 中的 getRange 函数,但它属于内部 PageMap 类,所以这是没有选择的。

于 2013-06-07T07:06:10.327 回答