【问题标题】:How to update toolbar when is store is got updated商店更新时如何更新工具栏
【发布时间】:2015-05-06 17:53:56
【问题描述】:

我正在尝试通过覆盖搜索条件操作中的开始和页面参数来加载商店。

 store.load({
 scope:store,
 params:{
        start:0,
        limit:10,
        page:1,
        searchCriterial:mysearchobject

        },
 callBack:function(){

                  }

 })

通过上面的代码,我可以加载商店,但是当我尝试使用上面的加载方法在第 2 页中加载商店时,数据正在加载,但工具栏仍显示第 2 页。当我用第 1 页加载商店时,我想更新分页工具栏。

我在分页工具栏中尝试了 loadPage 方法,但它正在调用另一个商店服务。

如何更改分页工具栏中的页码或将工具栏重置为第 1 页

【问题讨论】:

    标签: extjs extjs4 extjs5


    【解决方案1】:

    ExtJs 分页工具栏使用pageSize: itemsPerPage 和启动/限制参数来计算分页属性。

    根据提供的代码,您应该只需要在商店中指定 pageSize 参数,如下所示:

    var itemsPerPage = 2;   // set the number of items you want per page
    
    var store = Ext.create('Ext.data.Store', {
        id:'simpsonsStore',
        autoLoad: false,
        fields:['name', 'email', 'phone'],
        pageSize: itemsPerPage, // items per page
        proxy: {
            type: 'ajax',
            url: 'pagingstore.js',  // url that will load data with respect to start and limit params
            reader: {
                type: 'json',
                root: 'items',
                totalProperty: 'total'
            }
        }
    });
    
    // specify segment of data you want to load using params
    store.load({
        params:{
            start:0,
            limit: itemsPerPage
        }
    });
    

    【讨论】:

      猜你喜欢
      • 2011-11-18
      • 2018-06-29
      • 1970-01-01
      • 1970-01-01
      • 2012-09-01
      • 2016-02-06
      • 1970-01-01
      • 2020-08-11
      • 2019-07-23
      相关资源
      最近更新 更多