0

我正在从列表视图中获取联系人数据PhoneGap并显示到Sencha Touch列表视图中。ListPagination当滚动条结束时,我正在使用插件加载数据。

但问题ListPagination仅适用于远程数据,因此pageSize在这种情况下属性有效。

但在这里我将数据存储PhoneGap到一个数组中并使用 Ext.getStore('ContactStore').setData(arr).

那么有什么方法可以在Sencha Touch本地执行分页ListPagination吗?

4

2 回答 2

0

尝试覆盖存储的方法,仅使用整个数组的子集load调用它。setData()

在您的派生商店类中:

Ext.define('App.store.XXX', {
    extend: 'Ext.data.Store',
    config: {
        storeId: 'xxx',
        mypage: 0,              // use this as 'cursor' in your array
        pageSize: 10,              
        model: 'App.model.XXX',
        ...
    },
    load: function() {
        this.mypage += 1;
        // maybe add some sanity check on array dimension
        this.setData(Ext.Array.slice(arr, 0, this.mypage*this.getPageSize()));
    }
});

我没有测试上面的代码。将其作为解决方案的“想法”。

于 2013-08-21T20:01:25.373 回答
0

我在 Sencha Touch 2.4 中找到了从数组中获取分页列表的解决方案。诀窍是挂钩存储的 beforeload - 事件并从数组中设置数据的和平。

在这里你可以找到代码: http: //www.soft4tec.de/development/sencha-touch/list-paging-with-array-store.html

于 2015-08-10T15:34:37.223 回答