diff --git a/static/plugin_dbui/src/appjsonstore.js b/static/plugin_dbui/src/appjsonstore.js index 74450bfa861e5532861834238506643bc7ff6d84..7f3d8bf8eba4d6d0d95d8edd8321084246d5f3ed 100644 --- a/static/plugin_dbui/src/appjsonstore.js +++ b/static/plugin_dbui/src/appjsonstore.js @@ -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; + } } });