Gjslick
14 Dec 2009, 10:57 AM
Ext version tested:
Ext 3.0.3
Adapter used:
ext
css used:
only default ext-all.css
Browser versions tested against:
IE8
FF3 (firebug 1.4.5 installed)
Operating System:
WinXP Pro
Description:
The Ext.data.DirectStore's constructor will not create the JsonReader if the 'fields' config is an Ext.data.Record constructor (instead of an array of fields). The problem lies right in the conditional operator in the call to the DirectStore's superclass constructor:
reader: (typeof(c.reader) == 'undefined' && typeof(c.fields) == 'object') ? new Ext.data.JsonReader( ... The reader will not be created if c.fields is an Ext.data.Record constructor because in that case:
typeof( c.fields ) == 'function'
Test Case:
var myRecord = Ext.data.Record.create( [ 'field1', 'field2' ] );
var myStore = new Ext.data.DirectStore( {
fields: myRecord,
directFn: Ext.ss.MyClass.myMethod,
autoLoad: true
} );
Error: 'this.reader is undefined' (Edit: Was just doing a bit more testing, and the thrown error itself might have been coming from a ComboBox, but the reader still does not get defined and the store does not load data.)
Possible fix:
Either:
reader: (typeof(c.reader) == 'undefined' && ( typeof(c.fields) == 'object' || typeof(c.fields) == 'function' ) ) ? new Ext.data.JsonReader( ... Or just:
reader: (typeof(c.reader) == 'undefined' && c.fields ) ? new Ext.data.JsonReader( ...
Ext 3.0.3
Adapter used:
ext
css used:
only default ext-all.css
Browser versions tested against:
IE8
FF3 (firebug 1.4.5 installed)
Operating System:
WinXP Pro
Description:
The Ext.data.DirectStore's constructor will not create the JsonReader if the 'fields' config is an Ext.data.Record constructor (instead of an array of fields). The problem lies right in the conditional operator in the call to the DirectStore's superclass constructor:
reader: (typeof(c.reader) == 'undefined' && typeof(c.fields) == 'object') ? new Ext.data.JsonReader( ... The reader will not be created if c.fields is an Ext.data.Record constructor because in that case:
typeof( c.fields ) == 'function'
Test Case:
var myRecord = Ext.data.Record.create( [ 'field1', 'field2' ] );
var myStore = new Ext.data.DirectStore( {
fields: myRecord,
directFn: Ext.ss.MyClass.myMethod,
autoLoad: true
} );
Error: 'this.reader is undefined' (Edit: Was just doing a bit more testing, and the thrown error itself might have been coming from a ComboBox, but the reader still does not get defined and the store does not load data.)
Possible fix:
Either:
reader: (typeof(c.reader) == 'undefined' && ( typeof(c.fields) == 'object' || typeof(c.fields) == 'function' ) ) ? new Ext.data.JsonReader( ... Or just:
reader: (typeof(c.reader) == 'undefined' && c.fields ) ? new Ext.data.JsonReader( ...