PDA

View Full Version : capture paging event?



benny
23 May 2007, 4:58 AM
Hi,

I'm having problems trying to capture the load event of the paging toolbar.

I have a grid with toolbar, I wish to select the first row with each paging load. Any idea on how to capture the pageing load event?

BernardChhun
23 May 2007, 5:42 AM
hey there again!

to catch the paging event, I actually catch the Datastore's load event!


dataStore.on("load", loadFunction , this, true);

to select the 1st row:


loadFunction = function(){
if(this.grid.dataSource.getCount() == 0){
// do something when the number of data is equal to zero!
}else{
// select the 1st row!
this.grid.selModel.selectFirstRow();
}
}

benny
23 May 2007, 6:05 AM
thanks again Bernard,

It almost worked, I must have something else failing because I get this error:



l.fireFn has no properties
Observable()ext-all.js (line 15)
Observable()ext-all.js (line 15)
Store(Object success=true records=[22] totalRecords=80, Object params=Object, true)ext-all.js (line 71)
HttpProxy(Object params=Object request=Object reader=Object, true, Object tId=0 status=200 statusText=OK)ext-all.js (line 85)
Connection(Object tId=0 status=200 statusText=OK)ext-all.js (line 75)
setProgId(Object conn=XMLHttpRequest tId=0, Object scope=Object argument=Object timeout=30000, undefined)yui-utilities.js (line 15)
setProgId()yui-utilities.js (line 15)
[Break on this error] Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete...


I already tried to use:
ds.on('load', setTimeout(function() {gridActive.selModel.selectFirstRow()}, 300));

that also gave the above error, but I like your version better as it checks for Zero records (which I overlooked).

benny
23 May 2007, 6:54 AM
got it working :) I just moved the loadFunction function above the ds.on() and it's now working. Thanks Bernard