noelmartin
29 Sep 2009, 12:17 PM
How do I catch and handle the update event of a Ext DirectStore.
My code looks like this
LookupLists_Admin_IdValueGrid = function(table){
this.tableName = table;
this.dataStore = new Ext.data.DirectStore({
paramsAsHash:true,
autoLoad: true,
root: 'data',
idProperty: 'id',
totalProperty: 'total.totalcount',
baseParams: {start:0,limit:10,sort:'name',dir:'ASC', tableName: this.tableName},
fields: [ "id", "name" ],
api: {
read: OM_LookupLists.getListValues,
create: OM_LookupLists.getListValues,
destroy: OM_LookupLists.getListValues,
update: OM_LookupLists.getListValues
},
paramOrder: ['start','limit','sort','dir','tableName']
});
this.editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
LookupLists_Admin_IdValueGrid.superclass.constructor.call(this, {
title: 'List',
region: 'center',
closable: true,
loadMask: {msg:'Loading list data...'},
viewConfig: { autoFill: false },
plugins: [this.editor],
sm: new Ext.grid.RowSelectionModel({ singleSelect:true }),
store: this.dataStore,
columns: [
{header: 'ID', dataIndex: 'id', width: 100, sortable: true},
{header: 'Value', dataIndex: 'name', width: 300, sortable: true, editor: {xtype: 'textfield',allowBlank: false}}
]
]
});
}
Ext.extend(LookupLists_Admin_IdValueGrid,Ext.grid.GridPanel,{
});
The read api works and my grid loads.
The RowEditor works and marks a cell dirty after updates.
But the update api will not fire
My code looks like this
LookupLists_Admin_IdValueGrid = function(table){
this.tableName = table;
this.dataStore = new Ext.data.DirectStore({
paramsAsHash:true,
autoLoad: true,
root: 'data',
idProperty: 'id',
totalProperty: 'total.totalcount',
baseParams: {start:0,limit:10,sort:'name',dir:'ASC', tableName: this.tableName},
fields: [ "id", "name" ],
api: {
read: OM_LookupLists.getListValues,
create: OM_LookupLists.getListValues,
destroy: OM_LookupLists.getListValues,
update: OM_LookupLists.getListValues
},
paramOrder: ['start','limit','sort','dir','tableName']
});
this.editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
LookupLists_Admin_IdValueGrid.superclass.constructor.call(this, {
title: 'List',
region: 'center',
closable: true,
loadMask: {msg:'Loading list data...'},
viewConfig: { autoFill: false },
plugins: [this.editor],
sm: new Ext.grid.RowSelectionModel({ singleSelect:true }),
store: this.dataStore,
columns: [
{header: 'ID', dataIndex: 'id', width: 100, sortable: true},
{header: 'Value', dataIndex: 'name', width: 300, sortable: true, editor: {xtype: 'textfield',allowBlank: false}}
]
]
});
}
Ext.extend(LookupLists_Admin_IdValueGrid,Ext.grid.GridPanel,{
});
The read api works and my grid loads.
The RowEditor works and marks a cell dirty after updates.
But the update api will not fire