Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/docs/source/PagingToolbar.html view on Meta::CPAN
var msg = count == 0 ?
this.emptyMsg :
String.format(
this.displayMsg,
this.cursor+1, this.cursor+count, this.store.getTotalCount()
);
this.displayItem.setText(msg);
}
},
// private
onLoad : function(store, r, o){
if(!this.rendered){
this.dsLoaded = [store, r, o];
return;
}
var p = this.getParams();
this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
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);
this.prev.setDisabled(ap == 1);
this.next.setDisabled(ap == ps);
this.last.setDisabled(ap == ps);
this.refresh.enable();
this.updateInfo();
this.fireEvent('change', this, d);
},
// private
getPageData : function(){
var total = this.store.getTotalCount();
return {
total : total,
activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
};
},
<span id='Ext-PagingToolbar-method-changePage'> /**
</span> * Change the active page
* @param {Integer} page The page to display
*/
changePage : function(page){
this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));
},
// private
onLoadError : function(){
if(!this.rendered){
return;
}
this.refresh.enable();
},
// private
readPage : function(d){
var v = this.inputItem.getValue(), pageNum;
if (!v || isNaN(pageNum = parseInt(v, 10))) {
this.inputItem.setValue(d.activePage);
return false;
}
return pageNum;
},
onPagingFocus : function(){
this.inputItem.select();
},
//private
onPagingBlur : function(e){
this.inputItem.setValue(this.getPageData().activePage);
},
// private
onPagingKeyDown : function(field, e){
var k = e.getKey(), d = this.getPageData(), pageNum;
if (k == e.RETURN) {
e.stopEvent();
pageNum = this.readPage(d);
if(pageNum !== false){
pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
this.doLoad(pageNum * this.pageSize);
}
}else if (k == e.HOME || k == e.END){
e.stopEvent();
pageNum = k == e.HOME ? 1 : d.pages;
field.setValue(pageNum);
}else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
e.stopEvent();
if((pageNum = this.readPage(d))){
var increment = e.shiftKey ? 10 : 1;
if(k == e.DOWN || k == e.PAGEDOWN){
increment *= -1;
}
pageNum += increment;
if(pageNum >= 1 & pageNum <= d.pages){
field.setValue(pageNum);
}
}
}
},
// private
getParams : function(){
//retain backwards compat, allow params on the toolbar itself, if they exist.
return this.paramNames || this.store.paramNames;
},
// private
beforeLoad : function(){
if(this.rendered && this.refresh){
this.refresh.disable();
}
},
// private
doLoad : function(start){
var o = {}, pn = this.getParams();
( run in 0.820 second using v1.01-cache-2.11-cpan-787462296c9 )