PDA

View Full Version : Make jsonstore save() handle remove() records



Tulvan
5 May 2010, 11:10 AM
I am trying to save the edit of a EditorGridPanel with a JsonStore. Changes automatically mark rows as dirty, so they are sent with the save fine. My store has pruneModifiedRecords set to true. Still, removed records are not handled UNLESS I edit one of the fields as well. What am I missing here?

JsonStore:


var GlossaryStore = new Ext.data.JsonStore({
// destroy the store if the grid is destroyed
autoDestroy: true,
autoSave: false,
// load remote data using HTTP
url: 'GlossaryStore.php',
pruneModifiedRecords: true,
root: 'Terms',
writer: writer,
fields: ['Delete', 'ID', 'flgDelete', 'Term', 'Definition', 'Created', 'Edited', 'Delete'],
sortInfo: {field:'Term', direction:'ASC'}
}); // end var GlossaryStore = new Ext.data.JsonStore({
the save button just triggers this javascript function:


function SaveChanges(GlossaryStore)
{
// trigger the save to the db
GlossaryStore.save();

// if the save was successful, then commit the changes to the grid.
GlossaryStore.commitChanges();
} // function SaveChanges()
without including a ton of extra code, here is the panel the store is in:


var grid = new Ext.grid.EditorGridPanel({
id: 'GlossaryGrid',
store: GlossaryStore,
cm: cm, /* column model */
sm: extCheckBox, /* checkbox selection model */
renderTo: 'editor-grid',
width: 780,
height: 400,
autoExpandColumn: 'term', // column with this id will be expanded
title: 'Glossary Terms',
frame: true,
clicksToEdit: 1,
tbar:[{ /* removed for brevity */}]
});