【问题标题】:ExtJs Paging ignores totalPropertyExtJs 分页忽略了 totalProperty
【发布时间】:2013-04-10 08:13:17
【问题描述】:

我使用 ExtJs 4.1

我的网格工作正常,但在设置正确的分页时遇到问题。分页工具栏获取的记录数和页数错误。

服务器总共有 8 行,但只返回指定的 4 行。所以它应该是 2 页,每页 4 行。

Json 的初始加载如下:

{
    "value": {
        "data": [{
                "id": "user1",
                "title": "index0"
            }, {
                "id": "user2",
                "title": "index1"
            }, {
                "id": "user3",
                "title": "index2"
            }, {
                "id": "user4",
                "title": "index3"
            }
        ],
        "total": 8,
        "page": 1,
        "pages": 2,
        "pagesize": "4"
    }
}

设置

nItemsPerPage = 4;

分页工具栏

var oPagingToolbar = Ext.create( 'Ext.toolbar.Paging', {
            store         : oStoreUsers,
            pageSize      : nItemsPerPage,
            dock          : 'bottom',
            displayInfo   : true
         } );

我的grid有商店oStoreUsers和停靠的分页工具栏。

商店已加载:

// tried each of the following lines for loading
// none gave me 2 pages
oStoreUsers.load( { params: { start: 0, limit: nItemsPerPage } } );
oStoreUsers.loadPage( 1 );
oStoreUsers.loadPage( 1, { params: { start: 0, limit: nItemsPerPage } } );

商店有如下属性:

root: 'value.data',
pageSize: nItemsPerPage

问题:4行加载到存储中并显示在网格中。 但是,分页工具栏显示Page 1 of 1Displaying 1 - 4 of 4,而应该是Page 1 of 2Displaying 1 - 4 of 8

如何让它发挥作用?


编辑:

reader

   reader: {
           type         : 'json',
           root         : 'value.data',
           totalProperty: 'total'
        }

【问题讨论】:

  • 发布您的代理/阅读器配置。
  • 您指的是我编辑中的信息吗?

标签: extjs extjs4.1


【解决方案1】:

您的 totalProperty 不正确。必须是value.total

【讨论】:

  • 哦,伙计。我快疯了。现在它只是value.total。谢谢! ! !
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-11-20
  • 2013-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-22
  • 2011-12-22
相关资源
最近更新 更多