PDA

View Full Version : The easy way to make a hight performance list!



tidelgl
16 Jul 2011, 5:53 AM
1. me.pageNum = 1;
me.pageItems = Ext.is.iPad?25:20;//items per page
me.list.scroller.on('scrollend',me.onScrollerEnd,me);


2. onScrollerEnd : function(scroller,offsets){
var me = this,
lh = scroller.size.height,
h = me.list.getHeight(),
y = offsets.y;
if(me.filterValue && me.filterValue!=''){return;}
if(y==0){
if((me.pageNum>1)){
me.pageNum--;
me.doPaging ();
}
}else if((y+h)>=lh){
var c = me.listStore.getCount();
if(c > (me.pageNum*me.pageItems)){
me.pageNum++;
me.doPaging ();
}
}
},



3.
doPaging : function(){
var me = this,
n = me.pageNum,
y = me.pageItems;
me.helpStore.removeAll();
me.helpStore.add(me.listStore.getRange((n-1)*y, (n*y)));//here is the important key
me.list.bindStore(me.helpStore);//here is the important key
me.list.scroller.scrollTo({x: 0, y:0}, false);
},//end function doPaging

tidelgl
17 Jul 2011, 6:32 PM
high performance list!

tidelgl
19 Jul 2011, 1:52 AM
more about it,please see this
http://www.iunbug.com/article.html?objNews.id=246003