如略所示,由于某些需要,需要在刷新之前,进行其它赋值操作。
我试了下,在grid中的兼听,发现无效果,不知道该如何写?Ext.create('Ext.grid.Panel', {
    title: 'Simpsons',
    store: teststore,
    columns: [
        { text: 'Name',  dataIndex: 'name' },
        { text: 'Email', dataIndex: 'email', flex: 1 },
        { text: 'Phone', dataIndex: 'phone' }
    ],
    height: 200,
    width: 400,
        listeners:{
                 beforeshow: function(component, eOpts)
                {
//在这里写刷新前操作,发现无效,换了其它几个,也不行。                  
                }
      },    renderTo: Ext.getBody()
});请大虾指点

解决方案 »

  1.   

    配置gridpanel的应该事件没用,那些按钮是导航条控件Ext.toolbar.Paging的,但是找了下Ext.toolbar.Paging的API好像没有找到点击哪个按钮时触发对应的事件。。有一个总的事件beforechange( this, page, eOpts ),参数没有传递时哪个按钮一定要区分的可以结合beforechange事件+给paging添加mousedown事件来获取点击源对象一起判断,我是没找到对应的事件可以获取点击的是哪个按钮的,呵呵。。只能直接操作dom了
    bbar: Ext.create('Ext.PagingToolbar', {
                store: store,id:'pagetoolbar',
                displayInfo: true,
                displayMsg: 'Displaying topics {0} - {1} of {2}',
                emptyMsg: "No topics to display",
    listeners:{render:function(bar,opts){
    function check(e){
    e=e||event;
    window.objclick=e.srcElement||e.target;
    }
    var dom=bar.getEl().dom;
    if(dom.addEventListener)dom.addEventListener('mousedown',check,false);
    else if(dom.attachEvent)dom.attachEvent('onmousedown',check);
    },beforechange:function(){
    if(window.objclick){
      var cls=window.objclick.getElementsByTagName('span')[1].className;
      if(cls.indexOf('x-tbar-page-first')!=-1)alert('点击了首页按钮');
      else if(cls.indexOf('x-tbar-page-prev')!=-1)alert('点击了上一页按钮');
      else if(cls.indexOf('x-tbar-page-next')!=-1)alert('点击了下一页按钮');
      else if(cls.indexOf('x-tbar-page-last')!=-1)alert('点击了尾页按钮');
      else if(cls.indexOf('x-tbar-loading')!=-1)alert('点击了刷新按钮');
    }
    else alert('通过输入框回车后更改数据源!');
    }}/*,
                items:[
                    '-', {
                    text: 'Show Preview',
                    pressed: pluginExpanded,
                    enableToggle: true,
                    toggleHandler: function(btn, pressed) {
                        var preview = Ext.getCmp('gv').getPlugin('preview');
                        preview.toggleExpanded(pressed);
                    }
                }]*/
            })