문제

I have 2 row actions so i try to add row action ass bellow

var Action1 = {
                     id             : 'id_1',
                     header         : 'Action1',
                     keepSelection  : true,
                     actions        : [{
                                       iconIndex:'ACTION',
                                       qtipIndex:'QTIP1'
                                      }]
                     };


this.ObjAction1 = new Ext.ux.grid.RowActions(Action1); 
this.ObjAction1.on('action',this.myfunc, this);
this.grid.initPlugin(this.ObjAction1);
this.grid.colModel.addColumn(this.ObjAction1); 
this.grid.colModel.getColumnAt(4).width = 100;
// Actions column position
 this.grid.colModel.moveColumn(this.grid.colModel.getColumnCount()-1, 3); 

var Action2 = {
                     id             : 'id_2',
                     header         : 'Action2',
                     keepSelection  : true,
                     actions        : [{
                                       iconIndex:'ACTION',
                                       qtipIndex:'QTIP'
                                      }]
                     };


this.ObjAction2 = new Ext.ux.grid.RowActions(Action2); 
this.ObjAction2.on('action',this.myfunc, this); 
this.grid.initPlugin(this.ObjAction2);
this.grid.colModel.addColumn(this.ObjAction2); 
this.grid.colModel.getColumnAt(3).width = 100;

 this.grid.colModel.moveColumn(this.grid.colModel.getColumnCount()-1, 2); 

in my above code i used 2 times initPlugin() function(this.grid.initPlugin(this.ObjAction1); and this.grid.initPlugin(this.ObjAction2);) but when i used initPlugin() two times my grid popup not correctly close. I'm try to find initPlugin() but can't

도움이 되었습니까?

해결책

When you want to perform researches on the complete ext code base, just CTRL+F your version of ext-all-debug-w-comments.js. As you can see there, initPlugin is declared once in Ext.Component and called only twice, in the constructor of the same class. You can call that an easy to track code bit!

Here's its code:

initPlugin : function(p){
    if(p.ptype && !Ext.isFunction(p.init)){
        p = Ext.ComponentMgr.createPlugin(p);
    }else if(Ext.isString(p)){
        p = Ext.ComponentMgr.createPlugin({
            ptype: p
        });
    }
    p.init(this);
    return p;
},

It does not do much, it instantiates plugins passed as config object or string, and eventually calls the init method of the plugin, period. OMG, isn't that what deserve to be called "purity"? Anyway, this code is so simple to understand that it is obvious that your issue doesn't come from the fact that you're calling initPlugin twice. You're calling it with on a different instance each time, and only once on each... So that doesn't mess their state. I shot a brief glance to Ext.ux.grid.RowActions' code, and (unsurprisingly), it doesn't seem to mix its state into the prototype... Furthermore, even though I don't understand the entirety of the code you're showing, I don't see any red flag that you are breaking the state yourself either. You may be facing one of the buggy corner cases that are not so unusual in Ext 3, and especially in its "ux" (purity and candor are close relatives...).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top