0

我有一家附属于List. 该列表还使用ListPaging插件来启用分页。在我调用商店的load方法(或事件)后,商店将数据加载到列表中,向以下 url 发送请求 -

http://localhost/mysite/nodelist.php?_dc=1359309895493
    &tids=1%2C4%2C2%2C5%2C67&page=1&start=0&limit=10

向下滚动列表并按下Load More...(由插件附加到列表中)后,商店将另一个请求发送到相同的 url 但具有不同的参数,从而启用分页 -

http://localhost/mysite/nodelist.php?_dc=1359310357419
    &tids=1%2C4%2C2%2C5%2C67&page=2&start=10&limit=10 

现在我想重置商店的startand参数的值。page我尝试使用setExtraParam代理上的方法重置它,但如果我这样做,那么控件不会保持分页 - 这意味着当我按下时它不会自动更改pageand参数。startLoad More...

那么我该怎么做呢?

这是我商店的示例代码 -

Ext.define('MyApp.store.MyStore', {
    extend: 'Ext.data.Store',
    requires: [
        'Ext.data.reader.Json',
        'Ext.data.proxy.Ajax'
    ],

    config: {
        autoLoad: false,
        model: 'MyApp.model.MyModel',
        serverUrl: null,
        pageSize: 2,
        proxy: {
            type: 'ajax',
            actionMethods: {
                read: 'GET'
            },
            url: null,
            reader: {
                type: 'json'
            }
        },
        listeners: {
            beforeload: function () {
                console.log('Before load');
            },
            load: function (store) {
                // console.log('load');
            }
        }
    }
});

这是列表视图 -

list = {
    xtype: 'list',
    cls: 'myList',
    flex: 12,
    itemTpl: '{title}',
    store: 'MyStore',
    plugins: [
        {
            xclass: 'Ext.plugin.ListPaging',
            autoPaging: false
        }
    ],
    listeners: {
        select: {
            scope: this,
            fn: this.onSelect
        },
        swipe: {
            scope: this,
            element: 'element',
            fn: this.onListSwipe
        }
    }
};
4

1 回答 1

7

从查看源代码来看,也许您正在寻找商店的currentPage配置?

当您使用 ListPaging 插件加载更多录音时,它所做的只是nextPage在 store 中调用,然后loadPage使用currentPageconfig 调用。如果您currentPage在商店中将配置重置为 1,它只会假设开始回到 0,并且页面当然是 1。

于 2013-01-27T19:39:42.110 回答