首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何覆盖PagingToolbar中的刷新操作

如何覆盖PagingToolbar中的刷新操作
EN

Stack Overflow用户
提问于 2012-12-12 20:07:15
回答 2查看 9.5K关注 0票数 7

我需要编写一些基于分页工具栏中的刷新按钮的操作。如何重写doRefresh()方法?

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

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-12 20:57:46

如果你只想做一次使用

代码语言:javascript
复制
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);
         }
      }
});

或者用于所有的页面栏。

代码语言:javascript
复制
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);
     }
}

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

票数 13
EN

Stack Overflow用户

发布于 2012-12-13 16:09:34

代码语言:javascript
复制
Ext.create('Ext.PagingToolbar', {
  store: store,
  displayInfo: true,
  displayMsg: 'Displaying records {0} - {1} of {2}',
  emptyMsg: "No topics to display",
  doRefresh : function(){
     var me = this,
         current = me.store.currentPage;

     if (me.fireEvent('beforechange', me, current) !== false) {
        me.store.loadPage(1, {                                      
            callback: function (records, operation, success) {  
                Ext.getCmp('educationGrid').getSelection(records, operation, success);                                      
            }
        });
     }
  }

});

...................................

代码语言:javascript
复制
getSelection: function(records, operation, success){
    var grid= Ext.getCmp('educationGrid'); //my grid
    grid.getView().select(0);
}
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13839444

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档