We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28840
    • 46 Posts
    Hi folks,

    I have a problem and i cant get to make it work... I need to catch the "beforeedit" event in my code. The current code is:

    shopCC.grid.orderInner = function(config) {
    	
        config = config || {};
        Ext.applyIf(config,{
            id: 'shopcc-grid-order-inner'
            ,url: shopCC.config.connectorUrl
            ,baseParams: { action: 'orders/getgridinner', querytype: 'getGrid', query: shopCC.config.sid  }
            ,fields: ['sid','line','blago','aid','kolicina','cena']
    
            ,columns: [{
                header: _('shopCC.order.line')
                ,dataIndex: 'line'
    			,align: 'center'
                ,sortable: true
                ,width: 100
            },{
                header: _('shopCC.order.aid')
                ,dataIndex: 'aid'
    			,align: 'center'
                ,sortable: false
                ,width: 100
            },{
                header: _('shopCC.order.blago')
                ,dataIndex: 'blago'
                ,sortable:false
                ,width: 180
    			,editor: {
    				xtype: 'textfield' 
    				,renderer: true
    				,listeners: {
    					'beforeedit': {fn:function(e,r,t,m){
    						alert("workin");
    					},scope:this}
    						
    				}
    			}
            }]
        });
        shopCC.grid.orderInner.superclass.constructor.call(this,config);
    };
    
    
    Ext.extend(shopCC.grid.orderInner,MODx.grid.Grid,{});


    The "beforeedit" event isnt firing or i'm not catching it correctly....Any ideas?


    Sumoborac
      • 33968
      • 863 Posts
      Any other events working there, such as keyup or change?
        • 28840
        • 46 Posts
        I tried it but no luck... Am i missing some outside editor or something?

        I tried:
        ,listeners: {
                        	'show': {fn:function(r) {
                            	alert("works");
                        	},scope:this}
        					,'beforeedit': {fn:function(r) {
                            	alert("not working");
                        	},scope:this}
        					,'keyup': {fn:function(r) {
                            	alert("not working - keyup");
                        	},scope:this}
        					,'change': {fn:function(r) {
                            	alert("not working change");
                        	},scope:this}
                    	}

        And only the "show" event is trigged.

        File "manager / assets / modext / widgets / core / modx.grid.js" has the line:
        Ext.extend(MODx.grid.Grid,Ext.grid.EditorGridPanel,{ ...

        Which extends the EditorGridPanel which has the "beforeedit" event - http://docs.sencha.com/ext-js/3-4/#!/api/Ext.grid.EditorGridPanel-event-beforeedit

        Since i am extending my grid with modx.grid.Grid the events should be inhereted correct?

        Sumborac



          • 33968
          • 863 Posts
          I'm not sure about an outside editor but I'm wondering if the issue is like you say, perhaps there's something up with how they are - or are not - being inherited.

          I've had a lot of issues similar to yours where events that are present in the Ext widgets don't seem to be available within the extended ModExt versions. Particularly with keyup or change events needed to mark the form as 'dirty'.

          Would be cool if someone is able to shed some light on this!
            • 28840
            • 46 Posts
            I've just managed to figure out something from reading all over internet...

            The call for event was needed somewhere else - outside columns definition...

            ,columns: [
                  ....,{
                        header: _('shopCC.order.blago')
                        ,dataIndex: 'blago'
                        ,sortable:false
                        ,width: 180
            			,editor: {
            				xtype: 'textfield' 
            				
            			}
                    },....]
                });
                shopCC.grid.orderInner.superclass.constructor.call(this,config);
            	this.on('beforeedit',function(ob){console.log(ob);},this);



            And it works smiley
            Maybe the listeners from inside the columns dont get the whole event inherited?

            If someone knows of better solution, please share it with me laugh

            Sumoborac