PDA

View Full Version : change to ext.data.model behavior



pm100
28 Dec 2011, 5:52 PM
IN the old version I could call set on a field that did not exist (ie not declared in the fields array) and all was well, everything worked. In 4.1 that doesnt work. MY problem is that I dont know the fields I am going to get until very late - i get data from my server and it has fields in it; i just load them into the model object and off we go. I will admit that for some (not all) fields i did ext.apply(item.data, serverObject); which is not strictly speaking following the published interface but worked very nicely. Certainly there is no way that I can statically define a separate model item for my objects, I do not know in advance what they will be. Today I have just one 'abstract' class that has a well known set of control fields on it

mitchellsimoens
29 Dec 2011, 9:10 AM
There were reports that people didn't like the fields being changed. If the current behavior doesn't sit well for you then you can change the data object yourself and set the dirty flag. The only problem is if you require the use of the model/store keeping record of the modifications.

pm100
29 Dec 2011, 9:25 AM
not sure i understand

>>There were reports that people didn't like the fields being changed.
dont know what that means
>>If the current behavior doesn't sit well for you then you can change the data object yourself and set the dirty flag.
By 'current' do you mean 4.0.7 or 4.1?
If you mean that I should change my 4.1 test code to call setDirty after I merge my data into the model object - this doesn't work. The getData function (called by gird and tree) only returns data from defined fields

pm100
29 Dec 2011, 11:04 AM
simple work round for me was to override the getData method

getData:function()
{
return me.data;
}

not subtle - but effective