PDA

View Full Version : [OPEN] [UNKNOWN][3.??] Bug with ArrayReader and ID-Column



PICS
9 Sep 2009, 12:57 AM
When using an ArrayReader as store the getById doesn't work because the map was not built

the bug is in the function:
line 33508: Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {

Fix:
comment out line 33547:
// var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);

add new line at lin 33555:
var id = ((sid || sid === 0) && values[sid] !== undefined && values[sid] !== "" ? values[sid] : null);

Version: Ext JS Library 3.0.0 from 06.07.2009

regards, christian

Animal
9 Sep 2009, 1:18 AM
ArrayReader.js only has 96 lines!?

PICS
9 Sep 2009, 1:31 AM
Sorry, were the whole line-numbers of ext-all-debug

if this is line 1:
Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {

then remove line 40 and add the new line before line 48

Animal
9 Sep 2009, 1:57 AM
Not a bug.

The idIndex property specifies the index in the incoming row Array, not a Field name in the final Record.

Animal
9 Sep 2009, 1:58 AM
Perhaps an extra config is needed for DataReader:



idField


The name of the Field who's value to use as the Record's ID.

PICS
9 Sep 2009, 3:10 AM
Maybe that this will work, but my simple fix allows a usage like on the normal JSON store,
the correct thing in the Reader-Doc is:

var myReader = new Ext.data.ArrayReader({
idIndex (http://www.extjs.com/forum/../deploy/dev/docs/output/Ext.data.ArrayReader.html#Ext.data.ArrayReader-idIndex): 0
}, Employee);
( not idField )

So I recognized, that is not a bug, just a feature I had to add.

regards, christian

Animal
9 Sep 2009, 3:46 AM
No, in the JsonStore, the idProperty specifies a property name on the incoming row object, NOT the name of a Field in the resulting record.