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

    I have a 3 PC with some panels and grids which works fine. Now I need to update records from a grid, but I need to do that with a formPanel instead of the usual updateWindow....

    How can I do ?
    I tried to redirect on the formPanel fro my context menu with
    edition: function(btn,e){        
    		location.href = '?a=edition&item='+this.menu.record.id+'&namespace=myns';
    	},
    

    and to set a listener on my formPanel like this :
    listeners: {
       'setup': {fn:this.setup,scope:this},
       'beforeSubmit': {fn:this.beforeSubmit,scope:this}, 
       'success': {fn:this.success,scope:this}
    }
    


    But the setup is not fired, and I cannot access the object to update

    the setup function is
    
    setup: function(){
            console.log('in setup : '+MODx.request.item); // nothing in the console setup not initialized !
            if(!MODx.request.item) return '';
            MODx.Ajax.request({
                url: Mediaman.config.connectorUrl,
                params: {
                    action: 'mgr/edition',
                    id: MODx.request.item
                },
                listeners: {
                    'success': {fn:function(r) {
                        console.log('succes this');
                        console.log(this);
                        this.getForm().setValues(r.object);
                    },scope: this}
                }
            });
        }
    
    


    I did it this way with older versions of Revo (beta versions) and it worked but with the class based processors I probably miss something elementary... Any help would be appreciated
    Cheers [ed. note: anso last edited this post 14 years, 3 months ago.]
      • 33976 ☆ A M B ☆
      • 571 Posts
      Hi An'So,

      Just for the record, is your form panel extending MODx.FormPanel ?
        • 1778
        • 659 Posts
        Hi Romain,
        yes it is (I tried both MODx.FormPanel, and Ext.FormPanel with -same- no luck)!
        Cheers
          • 33976 ☆ A M B ☆
          • 571 Posts
          There are no setup even in Ext.form.FormPanel (neither in MODx.Panel)... had the problem once, that's why i was asking.

          Then would you mind posting your form panel ? (either i'm not completely sure about how you load it... -- hence the PM ;p).
            • 1778
            • 659 Posts
            Thanks Romain,
            As usual you saved my day ! I changed 'setup' event to 'beforeRender' and it seems ok, values are prefilled as expected...
            Thanks again.... 'til the next time I have some sh... in eyes (and maybe in brain too....)
            Cheers and thanks again
              • 33976 ☆ A M B ☆
              • 571 Posts
              anso,

              That's an option. Either that or manually adding the setup event… you might want to check how its done in MODx.FormPanel (you might also want to check the ExtJS doc)