Sencha touch2.4.1下拉翻页插件

由于缺省的Ext.plugin.PullRefresh只是重新请求加载proxy数据,所有每次加载都是将第一页的数据加载进来。

于是,有了修改的念头,以下是代码。

在2.4.0下测试OK

 

  /**

 * 下拉翻页插件
 * Created by wenbo on 2015-05-27.
 
*/
Ext.define('Member.util.PullPaging',{
    extend:'Ext.plugin.PullRefresh',
    xtype:'pullpaging',
    config:{
        pullText: '下拉刷新...',
        releaseText : '松开刷新...',
        loadingText : '请稍等...',
        loadedText : '加载...',
        lastUpdatedText : '最近刷新时间 '
    },
    fetchLatest: function() {
        var store = this.getList().getStore(),
            proxy = store.getProxy(),
            operation;

        //当前页加1
        store.currentPage += 1;

        //读取操作
        operation = Ext.create('Ext.data.Operation', {
            page: store.currentPage,
            start: store.currentPage*store.getPageSize(),
            model: store.getModel(),
            limit: store.getPageSize(),
            action: 'read',
            sorters: store.getSorters(),
            filters: store.getRemoteFilter() ? store.getFilters() : []
        });
        proxy.read(operation, this.onLatestFetched, this);
    }
});

 

posted @ 2015-05-27 15:48  爱编程的文子  阅读(120)  评论(0)    收藏  举报