Skip to content
Snippets Groups Projects
Commit 4ebba55f authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Add an handler to update the total number of records after a write action.

Have this information up to date is required by the paging plugin.
parent 6d613285
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,27 @@ App.data.DirectStore = Ext.extend(Ext.data.DirectStore, {
// instantiate the store
App.data.DirectStore.superclass.constructor.call(this, cfg);
// update the total number of records
this.on('write', this.onWrite);
},
/**
* Handler to update the total number of records after a write action
* @param {Object} store
* @param {Object} action
*/
onWrite: function (store, action) {
switch (action) {
case 'create':
store.totalLength += 1;
break;
case 'destroy':
store.totalLength -= 1;
break;
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment