javascriptextjsscrollextjs4.2

Get rid of "PageMap asked for range which it does not have" exception


Occassionally I get the exception "PageMap asked for range which it does not have" from my Ext Js 4.2.1 infinite scrolling grid. It is raised in data/PageMap.js on line 211. Of course one should not ask for non-existing entries, but this is sometimes done by the framework itself. Seems to be somehow connected to adding/removing records or reloading the grid. There are already some threads on this topic in the Sencha forum, e.g. this, but no killer solution or bugfix was proposed yet.

Meanwhile, I have to keep this exception from the users' eyes. What would be a good way to do so? Tricky thing is that it is sometimes provoked just by the user moving the scrollbar, so there is no single line of my code directly involved.


Solution

  • I found the root cause to be that when it's rendering rows, it determines if it's before a selected row. If it's working on the last row, it still looks for row + 1. (Ext.view.Table:931 in 4.2.1)

    My simple solution is to just make it return false:

    Ext.override(Ext.selection.RowModel,
    {
        isRowSelected: function (record, index)
        {
            try
            {
                return this.isSelected(record);
            }
            catch (e)
            {
                return false;
            }
        }
    });