日期:2014-05-16 浏览次数:20370 次
Ext.PagingToolbarOnly = Ext.extend(Ext.PagingToolbar, {
afterPageText:'',
beforePageText:'',
displayInfo:true,
displayMsg:'显示 {0} - {1} / {2}',
emptyMsg:'暂时没有数据',
firstText:'首页',
prevText:'前页',
nextText:'后页',
lastText:'末页',
refreshText:'刷新',
totalCount:0,
doLoad: function(n){
sURL = "controller.asp?action=list&page_no=" + n + "&page_size=" + this.pageSize + "&f=" + escape(sField)+ "&v=" + escape(sValue);
location.href = sURL + "&" + escape(new Date());
},
updateInfo: function(){
if(this.displayItem){
var count = this.store.getCount();
var msg = count == 0 ?
this.emptyMsg :
String.format(this.displayMsg,this.cursor+1, this.cursor+count, this.store.getTotalCount());
this.displayItem.setText(msg);
}
},
onLoad: function(store, r, o){
if(!this.rendered){
this.dsLoaded = [store, r, o];
return;
}
//if(!o.params
------解决方案--------------------
this.store.getTotalCount() == 0) this.cursor = 0;
if(!o.params
------解决方案--------------------
this.totalCount == 0) this.cursor = 0;
else this.cursor = (o.params[this.getParams().start] - 1) * this.pageSize + 1;
var d =this.getPageData(), ap = d.activePage, ps = d.pages;
this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
this.inputItem.setValue(ap);
this.first.setDisabled(ap == 1
------解决方案--------------------
ps == 0);
this.prev.setDisabled( ap == 1
------解决方案--------------------
ps == 0);
this.next.setDisabled(ap == ps
------解决方案--------------------
ps == 0);
this.last.setDisabled(ap == ps
------解决方案--------------------
ps == 0);
this.refresh.enable();
this.refresh.setDisabled(ps == 0);
this.updateInfo();
},
getPageData: function(){
var total = this.totalCount;//this.store.getTotalCount();
return {