View Full Version : Extjs 4.2.1 PageMap error while applying beforeSelectedItemCls

7 Aug 2013, 12:43 PM
Hello everyone,

I'm new to this forum so let me know if it is not the correct place for this post. I've found a bug in Ext.js 4.2.1. Looking through code I found that since this version, in Ext.view.Table, Extjs tries to apply a class saved as "beforeSelectedItemCls" to a row if the row after that is selected.

However there is a failing scenario for that. Assume that the table store is a buffered store and it has a page size of 100. If we load n times 100 (e.g. 100, 200, 300, etc.) records in it, while rendering the last record it fails, because not only the record after that doesn't exist (it's the last record), it happens to fall into next page.

Normally if there is no record at a certain index, store returns undefined. However if the store is buffered, and the index falls into another page it raises an error. It is a typical case happening while detecting if a row is "before selected item" when it is the last record on the page and last record of the store.

Gary Schlosberg
7 Aug 2013, 1:48 PM
That definitely sounds like a bug. Do you have some sample code that you could post which reproduces the problem?

7 Aug 2013, 8:03 PM
Well, I can point to the part of the code which is not working correctly, but here's a simple example I copied from Sencha Docs. I just made this up, so I'm not sure if it actually works. Just to demonstrate. The point is that number of records in the store is a multiply of Grid pageSize.

Ext.define (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-define)('User', {
extend: 'Ext.data.Model (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Model)',
fields: [
{name: 'age', type: 'int'}
var myStore = Ext.create (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-create)('Ext.data.Store (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.Store)', {
model: 'User',
buffered: true,
pageSize: 5,
proxy: {
type: 'ajax',
url: '/users.json',
reader: {
type: 'json',
root: 'users'
autoLoad: true;
Ext.create (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-create)('Ext.grid.Panel (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.Panel)', {

title: 'Simpsons',
store: myStore,
columns: [
{ text: 'Age', dataIndex: 'age' }
height: 200,
width: 400,
renderTo: Ext.getBody (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext-method-getBody)()


"users": [

Can someone verify if it actually fails? For me it goes through these functions:
Ext.data.PageMap#getRange (where it raises an error)

Sorry for the naive example. Please let me know if any part is missing.

Gary Schlosberg
8 Aug 2013, 3:16 PM
Looks like this is a known issue:

I was able to reproduce the issue, then I tried the code against the latest nightly and this issue is no longer a problem.