Results 1 to 3 of 3

Thread: Problem with form.on

  1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    159

    Default Problem with form.on

    Code:
    Ext.getCmp('mainForm').form.on('actioncomplete', function(form, action){
    	console.log(action.type);
    	if(action.type=='load'){
    		Ext.getCmp('invoiceselementsgrid3').store.load({params:{'id':id}});				
    	}
    }, this);
    
    Ext.getCmp('mainForm').getForm().load({url:'form/get_customers',params:{id:id}});
    I have problem with this code - on first run everything is ok, on second actioncomplete runs two times, on third - three times. What is wrong?

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854

    Default

    Suggest you set some breakpoints and see how many times you're executing that statement as you go thru - my guess would be that you're adding the listener each time thru.

  3. #3
    Sencha User
    Join Date
    Nov 2008
    Posts
    159

    Default

    Code:
    openDetail: function(id){
    Ext.getCmp("mainForm").getForm().reset();
    Ext.getCmp('mainForm').form.on('actioncomplete', function(form, action){
    	console.log(action.type);
    	if(action.type=='load'){
    		//Ext.getCmp('invoiceselementsgrid3').store.load({params:{'id':id}});
    	}
    }, this);
    console.log('test');
    Ext.getCmp('mainForm').getForm().load({url:'form/get_customers',params:{id:id}});
    },
    Problem is with line:
    Code:
    Ext.getCmp('mainForm').getForm().load({url:'form/get_customers',params:{id:id}});
    When i run openDetail "console.log('test')" is always ok - "console.log(action.type)" is first - one, second - two etc.
    I run openDetail with:

    Code:
    listeners:{
    	"rowclick":{
    		fn:function(grid, rowIndex, e){
    			var r = grid.getStore().getAt(rowIndex);			
    			this.openDetail(r.data['id']);
    		},scope:this
    	}
    }
    Edit: i checked this problem - run openDetail on button - the same problem. I use desktop.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •