extjs - 如何覆盖 PagingToolbar 中的刷新操作

标签 extjs extjs4 extjs4.1

我需要根据 Paging 工具栏中的刷新按钮编写一些操作。如何覆盖 doRefresh()方法?

this.bbar=Ext.create('Ext.PagingToolbar', {
      store: store,
      displayInfo: true,
      displayMsg: 'Displaying records {0} - {1} of {2}',
      emptyMsg: "No topics to display" 
});

最佳答案

如果你只想做一次使用

Ext.create('Ext.PagingToolbar', {
      store: store,
      displayInfo: true,
      displayMsg: 'Displaying records {0} - {1} of {2}',
      emptyMsg: "No topics to display",
      doRefresh : function(){
         // Keep or remove these code
         var me = this,
             current = me.store.currentPage;

         if (me.fireEvent('beforechange', me, current) !== false) {
             me.store.loadPage(current);
         }
      }
});

或所有页面栏。
Ext.PagingToolbar.prototype.doRefresh = function() {
     // Keep or remove these code
     var me = this,
         current = me.store.currentPage;

     if (me.fireEvent('beforechange', me, current) !== false) {
         me.store.loadPage(current);
     }
}

请注意,如果您这样做,您必须在每次更新 EXTJS 核心时仔细检查它以确保功能!

关于extjs - 如何覆盖 PagingToolbar 中的刷新操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13839444/

相关文章:

ExtJS 将附加数据添加到表单的帖子中

ExtJS 5.1 : Binding record value to component property

javascript - 使用 Sencha CMD 缩小现有 ExtJS 应用程序

java - 如何使用 Java Servlet 将图像从 Mongodb 发送到 Nextjs

javascript - 如何更改 ExtJs 中的拖放工具提示文本?

javascript - 分机 4.1.1 : Label inside a surrounding div

javascript - 如何在单选组 extjs 中禁用多选

带有附加选项的 Extjs4 组合框

ExtJS 4.1 : How to combine local data with ajax loaded data in a single store?

javascript - 在网格上添加带有组合框和文本区域的空行