I’m creating a class with extjs record in config. I keep a reference to this record. On creating the class instance I expected the record and It’s completely ok.
Later, in one of the object methods I’m trying to use this record. Quite unexpectedly the record has lost its store reference. Except this the record looks ok with the right data.
I hacked the situation keeping reference to the store in initialization phase:
this.store = this.recordLoosingItsStore.store;
And later I can retrieve my record like this:
var recordOK = this.store.getById( this.recordLoosingItsStore.getId() );
Can anyone shares opinion what’s happen and where my record.store disappears? How can I debug it easily? I tried to advice for store datachanged event but this didn’t produce any positive results.
If you check the documentation, it states that a record instance may only belong to a store instance at a time. Is it possible that you are assigning it to a different store at any point in your code and then destroying that other store? If that is the case, using the .copy method when assigning the record to a different store should solve the issue.
More info: http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Record