Results 1 to 3 of 3

Thread: Extend one Ext.window.Window class from another, buttons configuration problem

  1. #1

    Default 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',...
    Code:
    Ext.define('AM.view.user.Edit', {extend: 'AM.view.user.Add',alias: 'widget.useredit',...
    They have two buttons (Save and Close) that are initialized in initComponent()
    I try to select and bind click event to useredit AND useradd save buttons in my controller like this:
    Code:
    'useradd button[action=save]': {click: this.doCreateUser},
    'useredit button[action=save]': {click: this.updateUser}
    But when I click Save on useredit window, doCreateUser() called instead of updateUser()
    How can I fix it?
    Thank you and sorry about my bad English

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409

    Default

    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.

  3. #3

    Default

    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

Posting Permissions

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