View Full Version : Rowedtor emptyRecord.store is null if added to an empty store

21 Sep 2012, 1:48 AM
Hi all!

I have such a button handler in Extjs 4.1.0 controller.

Restful store is already loaded.
If i start editing any record - it works fine.
If i add emptyRecord to non-empty store - it works fine.

The issue is - emptyRecord.store is null if emptyRecord added to an empty store (0 records were loaded).
Ext.create() just returns record store 'null' with no exceptions.
Even more - emptyRecord.store stills null even after i manually set

emptyRecord.store = store.
Thus after completeEdit methood call in Roweditor.js nothing happend - because emptyRecord not bound to any store.
Editor just being hidden and no ajax call performed.What should i debug next? any clues?

var grid = Ext.getCmp('app-id-dataconsumerspanel'),
_model = 'te.model.DataConsumer',
_store = 'te.store.DataConsumer',
store = Ext.getStore(_store),
rowEditing = grid.plugins[0]

var emptyRecord = Ext.create(_model , {

if (!emptyRecord.store){
emptyRecord.store = store;


store.insert(0, emptyRecord);
rowEditing.startEdit(emptyRecord, 0);

24 Sep 2012, 5:46 AM
Once you do the store.insert it should be fine. Did you try just passing in an empty object to the store? Is the model you are creating the same model that is specified in the store? Did you set a breakpoint on the store.insert to see what happens?