PDA

View Full Version : Extjs selectionmodel, getselection bug with nested models



eevee
30 Oct 2013, 1:04 AM
I'm having a problem getting selected record, here are my nested Models:



Ext.define('my.Address', { extend: 'Ext.data.Model', idProperty: '__guid__', fields: ['title', 'latitude', 'longitude', '__guid__'] }); Ext.define('my.POS', { extend: 'Ext.data.Model', idProperty: '__guid__', fields: ['__guid__', '__title__', 'password', 'image', 'contact', 'category', { name: 'address', model: 'my.Address' }] });

Every times I post a record I reload the grid, but getting selected record (after delete an address and add a new one) in this way:




var rec = grid.getSelectionModel().getSelection()[0];

(rec is a my.POS) addresses inside the record has __guid__ equal to undefined. If I look into the store in this way:





grid.store.data.items[0].data.address[0].__guid__;
__guid__ property is present!

It seems that selection model get a copy of the record, not the 'reloaded' one.
Note that address is an array. Someone had this problem solved?

Thanks

Gary Schlosberg
31 Oct 2013, 8:06 PM
Sounds like this bug, which has been fixed for 4.2.3.
http://www.sencha.com/forum/showthread.php?261111