Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJs 4.2.0.663 using Searchfield results in Exception "PageMap asked for range which it does not have"

Tags:

extjs

extjs4.2

because ExtJS 4.2 seems to have a bug in using filters on an buffered grid (infinite grid), i rewrote my code and now i'm just using a simple search field to let the user search all over the grid's data. as long as something is found it works perfect but if nothing's found ext crashes with the exception "Page Map asked for range which it does not have"

my javascript "includes"

<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>

my store:

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);
         }
     }
 });  

my searchfield, located at the toolbar:

 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
         }
     ]
 }; 

please help ...

like image 880
timTaylor Avatar asked Nov 03 '22 02:11

timTaylor


1 Answers

I also had this problem. I posted to their forum (like others) and opened a support ticket. They did not come up with a solution for Ext JS 4.2, but the bug (and many others in buffered stores) got fixed in version 4.2.1. I think the nearly rebuilded most of the code there, so they did not have the option to make a cheap hotfix to 4.2.

Until I can migrate to 4.2.1 I wrapped all my find-record-calls with try-catch blocks. I also tried to override the getRange function in Store.js on line 3383, but it belongs to the internal PageMap class, so this is no option.

like image 174
Christoph Avatar answered Nov 08 '22 06:11

Christoph