I came across this strange behavior in ExtJS 3.2 on Firefox (haven’t tested in other browsers) If you name the element of an object the same as the object you are inserting it absorbs this object instead of nesting it. For example….
//In ExtJS.... The getAt method on a dataStore returns an object such that record.data exists var record = myDataStore.getAt(1); //If I then pass that to a constructor of another object such as a custom window var win = new myWindow({ record:record, width:500 }); // Where myWindow's constructor is defined to take an argument object of config like so... Window = Ext.extend(BCC.trace.TraceWindow,{ constructor: function(config){ .... } ..... })
I would expect that you would have an object like inside the constructor.
config.record.data
but instead you get
config.data
Oddly enough… .if you call it like this instead
var rec= myDataStore.getAt(1); var win = new myWindow({ record:rec, width:500 });
You get the correct
config.record.data
Why does it do this??? I have no idea. Seems sort of strange to me but perhaps it is supposed to work this way.
Advertisement
