-
1 Jun 2012 4:31 AM #1
Extend one Ext.window.Window class from another, buttons configuration problem
Extend one Ext.window.Window class from another, buttons configuration problem
Hi all, I have a problem with extends functionality
I have two window view object. Edit and Add
They are totally same so I extend Edit from Add window like this:
Code:Ext.define('AM.view.user.Add', {extend: 'Ext.window.Window',alias: 'widget.useradd',...They have two buttons (Save and Close) that are initialized in initComponent()Code:Ext.define('AM.view.user.Edit', {extend: 'AM.view.user.Add',alias: 'widget.useredit',...
I try to select and bind click event to useredit AND useradd save buttons in my controller like this:
But when I click Save on useredit window, doCreateUser() called instead of updateUser()Code:'useradd button[action=save]': {click: this.doCreateUser}, 'useredit button[action=save]': {click: this.updateUser}
How can I fix it?
Thank you and sorry about my bad English
-
1 Jun 2012 9:44 AM #2
Since the action is setup in useradd, that is used. The reference in the controller is not found, so it is jumping down to the based class. I would have a function called on your click event and then check your record for new/existing record and then redirect to add/edit function from there.
Scott.
-
2 Jun 2012 1:22 AM #3
Thanks
Scott
I dont know why but this configuration works
Code:'useredit button[action=save]': {click: this.updateUser}, 'useradd button[action=save]': {click: this.doCreateUser}
As you can see, I change order of useredit and useradd configuration in controller, and it works!
Is important which action bind first in these cases?
Thank u


Reply With Quote