-
23 Dec 2012 7:17 PM #1
How do you add a row of data to a store
How do you add a row of data to a store
I have a restful app that I am trying to add a button to a toolbar on a tab panel where the grid resides. The grid populates with data so now I want to add a button who's action would be add a blank row in the grid. I have tried cancelEdit() , store.insert(0, model) to no avail. I need someone to point me in the right direction. My store looks like this:
//Thanks in advance
Ext.define('ShopTrack.store.UserMasterStore', {
extend: 'Ext.data.Store',
alias: 'store.userMasterStore',
requires: [
'ShopTrack.model.User'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
autoSync: true,
filterOnLoad: false,
sortOnLoad: false,
storeId: 'userMasterStore',
model: 'ShopTrack.model.User',
proxy: {
type: 'rest',
url: 'http://localhost/services/webresources/shoptrack.usermaster/',
reader: {
type: 'xml',
root: 'userMasters',
record: 'userMaster'
}
}
}, cfg)]);
}
});
-
25 Dec 2012 8:04 PM #2
I found the answer to my own question. Being the code editing features of Architect are limited and the fact I am new to Ext, I found that by assigning the instance of the store to a variable using getStore(StoreName) then using that vartiable to do a store.add(ModelRecord).
-
1 Jan 2013 2:38 PM #3
You are correct

Code:store.add({ /* config */ });Aaron Conran
@aconran
Sencha Architect Development Team


Reply With Quote