-
22 Jun 2012 5:08 AM #1
[ExtJS 4.1] Copying of models is broken in 4.1
[ExtJS 4.1] Copying of models is broken in 4.1
I was used to decorate my models in ExtJS 4.0 with additional data properties on the fly (Need this for tree nodes). When copying the decorated record a via b = a.copy() all of my decorations to a were also copied to b.
In ExtJS 4.1 only the fields which are defined in the model a are getting copied! Is this change intended in 4.1 or a bug?
An exmaple code to test (once with 4.0, then 4.1)
See the difference? I really would like to know how I should make exact copies of my model records now. Help and suggestions appreciated!Code:Ext.define('Test', {extend: 'Ext.data.Model', fields: ['property1']}); a = Ext.create('Test', {property1: 'Teast A'}); a.set('property2', 'My decoration'); b = a.copy(); console.log("A:", a.data); console.log("B:",b.data);
-
22 Jun 2012 12:22 PM #2
It's a bug!
Test this override:
If that works for you, I'll open a ticket and get the fix in.Code:Ext.override(Ext.data.Model, { copy : function(newId) { var me = this; return new me.self(me.raw, newId, null, Ext.apply({}, me[me.persistenceProperty])); } });Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
23 Jun 2012 5:58 AM #3
Yes, this works now! You can try it with my example above as well! Thx for fixing this, then I can remove my temprary workaround :-)
-
23 Jun 2012 6:56 AM #4
It's slated for the 4.1.2 release.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-6627
in
4.1.


Reply With Quote