Skip to content
Snippets Groups Projects
Commit 9651e43e authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove the reset button. The paging plugin is reset when receiving the

resetgrid event.
parent 6866ac76
No related branches found
No related tags found
No related merge requests found
...@@ -19,13 +19,12 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -19,13 +19,12 @@ App.grid.Paging = Ext.extend(Object, {
ptype: 'pGridPaging', ptype: 'pGridPaging',
/** /**
* Private attributs for internationalization * Private attribute for internationalisation
*/ */
textReset: 'Reset',
textSlider: 'Rows per page', textSlider: 'Rows per page',
/** /**
* Plugin initialization * Plugin initialisation
*/ */
init: function (grid) { init: function (grid) {
...@@ -37,7 +36,7 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -37,7 +36,7 @@ App.grid.Paging = Ext.extend(Object, {
// replace the bottomtool bar by the pagingtool bar // replace the bottomtool bar by the pagingtool bar
grid.bottomToolbar = bbar; grid.bottomToolbar = bbar;
// add slider and export button // add slider
bbar.add( bbar.add(
'-', '-',
this.textSlider, this.textSlider,
...@@ -50,18 +49,12 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -50,18 +49,12 @@ App.grid.Paging = Ext.extend(Object, {
}, },
minValue: 1, minValue: 1,
width: 100 width: 100
}, '-', {
xtype: 'button',
iconCls: 'xaction-download',
listeners: {click: this.onReset,
scope: grid},
tooltip: this.textReset
}, '-' }, '-'
); );
// Initialize the parameters of the paging and slider widgets. // Initialise the parameters of the paging and slider widgets.
// Depends on the status of the store. // Depends on the status of the store.
// Initialization is only performed once. // Initialisation is only performed once.
if (grid.store.getTotalCount() > 0) { if (grid.store.getTotalCount() > 0) {
this.onInit.call(grid, grid.store); this.onInit.call(grid, grid.store);
...@@ -75,6 +68,10 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -75,6 +68,10 @@ App.grid.Paging = Ext.extend(Object, {
// update the slider parameter after a write action // update the slider parameter after a write action
// which destroy and create records // which destroy and create records
grid.store.on('write', this.onWrite, grid); grid.store.on('write', this.onWrite, grid);
// reset paging and slide parameter on a grid reset
grid.on('resetgrid', this.onReset, grid);
}, },
/** /**
...@@ -88,7 +85,7 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -88,7 +85,7 @@ App.grid.Paging = Ext.extend(Object, {
}, },
/** /**
* Handler to initialize the number of rows per page and the number of page * Handler to initialise the number of rows per page and the number of page
* the scope is the grid * the scope is the grid
*/ */
onInit: function (store, records, options) { onInit: function (store, records, options) {
...@@ -109,26 +106,21 @@ App.grid.Paging = Ext.extend(Object, { ...@@ -109,26 +106,21 @@ App.grid.Paging = Ext.extend(Object, {
}, },
/** /**
* Handler to reload the grid store * Handler to reset the paging parameters
* The scope is the grid * The scope is the grid
*/ */
onReset: function() { onReset: function() {
var bbar, var bbar,
grid = this, grid = this;
nRows = 10;
bbar = grid.getBottomToolbar(); bbar = grid.getBottomToolbar();
bbar.pageSize = nRows; bbar.pageSize = grid.nRows;
bbar.moveFirst();
slider = bbar.findByType('slider')[0];
grid.store.load({params: {start: 0, limit: nRows}, callback: function() { slider = bbar.findByType('slider')[0];
bbar.moveFirst(); slider.setMaxValue(grid.store.getTotalCount());
slider.setMaxValue(grid.store.getTotalCount()); slider.setValue(grid.nRows);
slider.setValue(nRows);
}, scope: this});
}, },
/** /**
* Handler to update the slider/bottomToolBar parameters after a store write action. * Handler to update the slider/bottomToolBar parameters after a store write action.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment