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

re-visited version

parent b2a4cc1d
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,10 @@
* The paging bottom bar plugin
* The ptype of this component is pGridPaging.
*
*
* NOTE: the number of row load in hte grid the first time is defined
* by the grid when loading the store.
*
* @version $Id$
*
*/
......@@ -15,7 +19,7 @@ App.grid.Paging = Ext.extend(Object, {
ptype: 'pGridPaging',
/**
* Plugin intialisation
* Plugin initialization
*/
init: function (grid) {
......@@ -50,12 +54,14 @@ App.grid.Paging = Ext.extend(Object, {
bbar.show();
// NOTE: when this plugin is used, the grid load the store
// with the first row only. The results contains the total
// number of records in the store. We used it to initialized
// properly the slider.
grid.store.on('load', this.onStoreLoad, grid);
// if the store is already load initialize the parameters
// of the paging and slider widgets
// Otherwise, way the store is loaded
if (grid.store.getTotalCount() > 0) {
this.onStoreLoad.call(grid, grid.store);
} else {
grid.store.on('load', this.onStoreLoad, grid);
}
},
/**
......@@ -79,7 +85,10 @@ App.grid.Paging = Ext.extend(Object, {
*/
onStoreLoad: function (store, records, options) {
var bbar, grid = this, nRows = 10, slider;
var bbar,
grid = this,
nRows = store.getCount(),
slider;
if (grid.pagingInitialized) {
return;
......@@ -88,19 +97,12 @@ App.grid.Paging = Ext.extend(Object, {
grid.pagingInitialized = true;
bbar = grid.getBottomToolbar();
bbar.pageSize = nRows;
slider = bbar.findByType('slider')[0];
// NOTE: the number of row which visible in the browser
// can be obtained having a look to the DOM tree finding
// CSS component name x-grid3-cell-inner. Then by comparing
// the innerHeight of the browser window and the height of the
// cell we can compute the number of rows ? For later !!
slider.maxValue = store.totalLength;
slider.maxValue = store.getTotalCount();
slider.setValue(nRows);
bbar.pageSize = nRows;
bbar.moveFirst();
}
});
......
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