I have a FormPanel. This form triggers a JsonStore to get data from the database. The store populates a second store. The second store populates a GridPanel. Each time the form is submitted, I need the data from the first store to be added (appended) into the second store, not replace it. Currently when I refresh the grid, the resultset from the second query replaces the first.
Is there a public method for one of these objects I do not know about?
Code samples follow:
The form triggers this store. Assume baseParams maps to: form.getForm().getValues()
PHP Code:
var dsUsersProxy = new Ext.data.JsonStore({
url: './?event=ajax.groupMempers.do',
baseParams: baseParams,
autoLoad: true,
root: 'data',
fields: ['displayvalue', 'rowid']
});
This is the second store. Assume JReader maps to a JsonReader which has a Record.create().
PHP Code:
var dsUsers = new Ext.data.Store({
reader: JReader
});
This loads the data from the first store into the second store. This is where the problem is. I have used add() and insert() and both replace the existing data. There is no JS error but the data is overwritten. I have verified this with console.dir(dsUsers)
PHP Code:
dsUsersProxy.on('load', function(){
var userRecords = dsUsersProxy.getRange();
//dsUsers.add(userRecords);
dsUsers.insert(0, userRecords);
console.log(dsUsers.data.length);
});