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

Add an handler to update the slider with total number of records.

parent 4ebba55f
No related branches found
No related tags found
No related merge requests found
......@@ -64,10 +64,15 @@ App.grid.Paging = Ext.extend(Object, {
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);
},
/**
* Handler to change the number of rows per page
* the scope is the bottom tool bar
*/
onChangePageSize: function (slider, newValue, thumb) {
var bbar = this;
......@@ -84,6 +89,7 @@ App.grid.Paging = Ext.extend(Object, {
/**
* Handler to initialize the number of rows per page and the number of page
* the scope is the grid
*/
onInit: function (store, records, options) {
......@@ -100,11 +106,28 @@ App.grid.Paging = Ext.extend(Object, {
bbar.pageSize = nRows;
slider = bbar.findByType('slider')[0];
slider.maxValue = store.getTotalCount();
slider.setMaxValue(store.getTotalCount());
slider.setValue(nRows);
}
},
/**
* Handler to update the slider parameter after a store write action.
* The latter create or destroy records in the store.
* The scope is the bottom grid
*/
onWrite: function() {
var bbar,
grid = this;
bbar = grid.getBottomToolbar();
slider = bbar.findByType('slider')[0];
slider.setMaxValue(grid.store.getTotalCount());
slider.setValue(grid.store.getCount());
}
});
Ext.preg('pGridPaging', App.grid.Paging);
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