重写 Ext.toolbar.Paging 扩展功能

直接代码,放项目overrides文件夹中即可

//重写类 分页插件
//汉化
//默认下方布局
//默认显示额外信息
//当删除数据时,处理页面变化
Ext.define("override.toolbar.Paging", {
    override: "Ext.toolbar.Paging",
    displayMsg: '显示 {0} - {1} 条,共 {2} 条',
    emptyMsg: '没有要显示的数据',
    beforePageText: '第',
    afterPageText: '页,共 {0} 页',
    firstText: '第一页',
    prevText: '上一页',
    nextText: '下一页',
    lastText: '最后一页',
    refreshText: '刷新',
    dock: 'bottom',
    displayInfo: true,
    //新增remove监听
    getStoreListeners: function () {
        return {
            beforeload: this.beforeLoad,
            load: this.onLoad,
            exception: this.onLoadError,
            remove: this.onRemoveRecords
        };
    },
    //当删除数据时
    onRemoveRecords: function (store, records) {
        var me = this,
        //当前页数据总数
        count = store.getCount(),
        //当前页码
        currentPage = store.currentPage,
        //页面总数
        pageCount = me.getPageData().pageCount,
        //数据总数
        totalCount = store.getTotalCount();
        //当前页已经没有数据
        if (count == 0) {
            if (pageCount == currentPage) {
                //如果是最后一页,显示上一页
                me.movePrevious();
            } else {
                //不是最后一页,刷新
                me.doRefresh();
            }
        } else {
            //重新设置数据总数
            store.totalCount = totalCount - records.length;
            //刷新页面
            me.updateInfo();
        }
    }
});

 

转载于:https://www.cnblogs.com/mlzs/p/5595765.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值