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

Polish.

the new handler onInit is only execute once.
parent f2089fe6
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,8 @@
* 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.
* NOTE: the number of row load in the grid at the first time
* is defined by the grid when loading the store.
*
* @version $Id$
*
......@@ -25,9 +25,7 @@ App.grid.Paging = Ext.extend(Object, {
var bbar;
grid.pagingInitialized = false;
// associate the bbar to the grid store
// link the bbar and the grid store
bbar = grid.getBottomToolbar();
bbar.bindStore(grid.store);
......@@ -54,13 +52,17 @@ App.grid.Paging = Ext.extend(Object, {
bbar.show();
// if the store is already load initialize the parameters
// of the paging and slider widgets
// Otherwise, way the store is loaded
// Initialize the parameters of the paging and slider widgets.
// Depends on the status of the store.
// Initialization is only performed once.
if (grid.store.getTotalCount() > 0) {
this.onStoreLoad.call(grid, grid.store);
this.onInit.call(grid, grid.store);
} else {
grid.store.on('load', this.onStoreLoad, grid);
grid.store.on('load', this.onInit, grid, {single: true});
}
},
......@@ -81,10 +83,11 @@ App.grid.Paging = Ext.extend(Object, {
},
/**
* Handler to tune the number of rows per page and the number of page
* Handler to initialize the number of rows per page and the number of page
*/
onStoreLoad: function (store, records, options) {
onInit: function (store, records, options) {
console.log('fgfghgh');
var bbar,
grid = this,
nRows = store.getCount(),
......@@ -94,8 +97,6 @@ App.grid.Paging = Ext.extend(Object, {
return;
}
grid.pagingInitialized = true;
bbar = grid.getBottomToolbar();
bbar.pageSize = nRows;
......
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