brumble
24 Apr 2007, 7:38 PM
hi guys, may i know how do i change the count of totalProperty before the datastore load?
my method which is not right:
ds.on('beforeLoad', function(){
function setParams(start, limit, sort, dir){
var params = {}, map = this.paramMap;
ds.reader.totalProperty = (threaded.selectedIndex < 2) ? 'Messages.firstCnt' : 'Messages.secondCnt';
params['page'] = paging.getPageData().activePage;
params['rows'] = paging.pageSize;
params['sortfield'] = (sort == 'dateCol') ? 'date' : sort;
params['sortorder'] = (dir == 'ASC') ? '1' : '0';
return params;
};
ds.baseParams = setParams();
});
the old method thats working:
dm.createParams = function(pageNum, sortColumn, sortDir){
var params = {}, map = this.paramMap;
for(var key in this.baseParams){
if(typeof this.baseParams[key] != 'function'){
params[key] = this.baseParams[key];
}
}
this.schema.totalProperty = (threaded.selectedIndex < 2) ? 'Messages.firstCnt' : 'Messages.secondCnt';
params['page'] = pageNum;
params['rows'] = this.getPageSize();
params['sortfield'] = (sortColumn == 8) ? 'date' : this.schema.fields[sortColumn];
params['sortorder'] = (sortDir == 'ASC') ? '1' : '0';
return params;
};
hope you guys could highlight to me whats wrong, thanks!
my method which is not right:
ds.on('beforeLoad', function(){
function setParams(start, limit, sort, dir){
var params = {}, map = this.paramMap;
ds.reader.totalProperty = (threaded.selectedIndex < 2) ? 'Messages.firstCnt' : 'Messages.secondCnt';
params['page'] = paging.getPageData().activePage;
params['rows'] = paging.pageSize;
params['sortfield'] = (sort == 'dateCol') ? 'date' : sort;
params['sortorder'] = (dir == 'ASC') ? '1' : '0';
return params;
};
ds.baseParams = setParams();
});
the old method thats working:
dm.createParams = function(pageNum, sortColumn, sortDir){
var params = {}, map = this.paramMap;
for(var key in this.baseParams){
if(typeof this.baseParams[key] != 'function'){
params[key] = this.baseParams[key];
}
}
this.schema.totalProperty = (threaded.selectedIndex < 2) ? 'Messages.firstCnt' : 'Messages.secondCnt';
params['page'] = pageNum;
params['rows'] = this.getPageSize();
params['sortfield'] = (sortColumn == 8) ? 'date' : this.schema.fields[sortColumn];
params['sortorder'] = (sortDir == 'ASC') ? '1' : '0';
return params;
};
hope you guys could highlight to me whats wrong, thanks!