情景描述:使用List组件中分页的插件plugins时,当通过下拉翻至最后一页时,提示文字并为由“更多....”变为“没有更多条记录了”,而且下拉事件也未禁用掉。

完整代码如下:

plugins: [
 {
            xclass: 'Ext.plugin.PullRefresh',
            pullRefreshText: '下拉可以更新',
            releaseRefreshText: '松开开始更新',
            loading: '正在刷新……',
            refreshFn: function (loaded, arguments) {
               loaded.getList().getStore().loadPage(1, {
                  callback: function (record, operation, success) {
                      Ext.Viewport.unmask();
                  }, scope: this
              });
            }
 },
 {
           xclass: 'Ext.plugin.ListPaging',
           loadMoreText: '更多……',
           noMoreRecordsText: '没有更多条记录了',
           autoPaging: true //设置为TRUE将自动触发
}
]

解决方法:查看sencha-touch API文档ListPagin的源码可知:

message  = this.storeFullyLoaded() ? this.getNoMoreRecordsText() : this.getLoadMoreText();
storeFullyLoaded: function() {
        var store = this.getList().getStore(),
            total = store.getTotalCount();
        return total !== null ? store.getTotalCount() <= (store.currentPage * store.getPageSize())  : false;
}

当storeFullyLoaded()函数返回true时,应该显示noMoreRecordsText值,因此可以想到是后台没有将TotalCount值返回到客户端。

total:25}形式返回到客户端即可!

注:当有多个返回节点时,记得是放在根节点下!!

相关文章:

  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-27
  • 2022-12-23
  • 2021-12-24
  • 2021-08-09
猜你喜欢
  • 2022-12-23
  • 2021-06-15
  • 2021-11-09
  • 2021-07-25
  • 2021-09-27
  • 2021-11-26
  • 2021-05-17
相关资源
相似解决方案