ExtJs还不怎么熟悉 希望各位前辈多多指教
userInfoStore.load({params : {start : 0, limit : 20}});
比如这样加载一个数据源
怎么获得当前是第几页 然后数据加载后停留在当前页面上
------解决方案--------------------
这两个参数还算不出来当前页?
- JScript code
{start : 0, limit : 20}
------解决方案--------------------
userInfoStore.load({params : {start : 0, limit : 20}});
如果是第二页就
userInfoStore.load({params : {start : 2, limit : 20}});
以此类推白
------解决方案--------------------
当前第几页:(start / limit) + 1
------解决方案--------------------
打开源码PagingToolbar.js
找到
- JScript code
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); }
------解决方案--------------------
应该是找到下面这段
- JScript code
doLoad : function(start){ var o = {}, pn = this.getParams(); o[pn.start] = start; o[pn.limit] = this.pageSize; if(this.fireEvent('beforechange', this, o) !== false){ this.store.load({params:o}); } }
------解决方案--------------------
------解决方案--------------------
你要实现什么效果啊?
------解决方案--------------------
doRefresh : function(){
var me = this,
current = me.store.currentPage;
if (me.fireEvent('beforechange', me, current) !== false) {
me.store.loadPage(current);
}
},