diff --git a/static/plugin_dbui/src/pgridpaging.js b/static/plugin_dbui/src/pgridpaging.js deleted file mode 100644 index a919514e77b161e10b0779d1667528f9b9211277..0000000000000000000000000000000000000000 --- a/static/plugin_dbui/src/pgridpaging.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * The grid plugin instantiating the paging bottom bar. - * It contains the widget to navigate between page and a slider - * to fixed the number of rows per page. - * - * **Note**: the number of row load in the grid at the first time - * is defined by the grid when loading the store. - * - */ -Ext.define('App.grid.Paging', { - - extend: 'Object', - alias: 'plugin.pGridPaging', - - // Private property for internationalisation - textSlider: 'Rows per page', - - /** - * The plugin initialization - * - * @param {App.grid.Grid} grid - * - */ - init: function (grid) { - - "use strict"; - - var bbar; - - // create the paging bar - bbar = new Ext.PagingToolbar({store: grid.store}); - - // replace the bottom toolbar by the paging toolbar - Ext.destroyMembers(grid, 'bottomToolbar'); - grid.bottomToolbar = bbar; - - // add slider - bbar.add( - '-', - this.textSlider, - { - xtype: 'slider', - plugins: new Ext.slider.Tip(), - listeners: { - changecomplete: this.onChangePageSize, - scope: bbar - }, - minValue: 1, - width: 100 - }, - '-' - ); - - // Initialise the parameters of the paging and slider widgets. - // Depends on the status of the store. - // Initialisation is only performed once. - if (grid.store.getTotalCount() > 0) { - - this.onInit.call(grid, grid.store); - - } else { - - grid.store.on('load', this.onInit, grid, {single: true}); - - } - - // update the slider parameter after a write action - // which destroy and create records - grid.store.on('write', this.onWrite, grid); - - // reset paging and slide parameter on a grid reset - grid.on('resetgrid', this.onReset, grid); - }, - - // - // Private method to destroy the plugin. - // Reset the slider and the paging parameters to default values. - // Purge grid and store listeners associated to the plugin. - // Destroy the bottom toolbar. - // - // @param {App.grid.Grid} grid - // - destroyPlugin: function (grid) { - - "use strict"; - - var slider; - - // purge listeners - grid.store.un('write', this.onWrite, grid); - grid.un('resetgrid', this.onReset, grid); - - // destroy slider tooltip - slider = grid.bottomToolbar.findByType('slider')[0]; - Ext.destroyMembers(slider, 'plugins'); - }, - - /** - * Fire when the slider value is change by the user. - * The scope is the bottom tool bar. - * - * @param {Ext.slider.SingleSlider} slider - * - * @param {Number} newValue - * The new value which the slider has been changed too. - * - * @param {Ext.slider.Thumb} thumb - * the thumb that was changed. - * - */ - onChangePageSize: function (slider, newValue, thumb) { - - "use strict"; - - var bbar = this; - bbar.pageSize = newValue; - bbar.moveFirst(); - }, - - /** - * Initialise the number of rows per page and the number of page. - * It is fired during the initialization or when the store is loaded. - * The scope is the grid. - * - * @param {Ext.data.Store} store - * - * @param {Ext.data.Record[]} records - * The records that were loaded. - * - * @param {Object} options - * The loading option that where specified. - */ - onInit: function (store, records, options) { - - "use strict"; - - var bbar, - grid = this, - nRecords = store.getTotalCount(), - nRows, - slider; - - nRows = grid.nRows; - - bbar = grid.getBottomToolbar(); - bbar.pageSize = nRows; - bbar.moveFirst(); - - slider = bbar.findByType('slider')[0]; - slider.setMaxValue(nRecords); - slider.setValue(nRows); - }, - - /** - * Reset the paging parameters. - * The scope is the grid. - * - */ - onReset: function() { - - "use strict"; - - var bbar, - grid = this, - slider; - - bbar = grid.getBottomToolbar(); - bbar.pageSize = grid.nRows; - bbar.moveFirst(); - - slider = bbar.findByType('slider')[0]; - slider.setMaxValue(grid.store.getTotalCount()); - slider.setValue(grid.nRows); - }, - - /** - * Update the slider/bottomToolBar parameters after a store write action. - * The latter create or destroy records in the store. - * The scope is the bottom grid. - */ - onWrite: function () { - - "use strict"; - - var bbar, - grid = this, - slider; - - bbar = grid.getBottomToolbar(); - bbar.pageSize = grid.store.getCount(); - - slider = bbar.findByType('slider')[0]; - slider.setMaxValue(grid.store.getTotalCount()); - slider.setValue(grid.store.getCount()); - } -}); \ No newline at end of file