Results 1 to 4 of 4

Thread: How to access parent window object

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1

    Default Answered: How to access parent window object

    Hi all,

    I have a window (Window 1)with one button.
    On the button click action i am opening another window(Window 2).
    When i will close the window 2 then i want to change the window 1 button text.

    how i will access window 1 object while closing window 2?

    please help how i will achieve this?

    Thanks.

  2. Hi, Thanks for your reply.

    i got the solution.
    Code:
    var window1Obj = Ext.ComponentQuery.query('firstwindow')[0];  //where firstwindow is userAlias name of Window 1
    
    window1Obj.down('#btn').setText('New text');
    Using window1Obj, we can access any control of window 1.

  3. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,257
    Answers
    759

    Default

    Are you using MVC? What does your code look like?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Bangalore,IN
    Posts
    114
    Answers
    6

    Default

    In the Listener event of the window 2 close, add

    Code:
    Ext.getCmp('the-button-id').setText('your-text-here');
    If the window 1 is configured in a object, try

    Code:
    windowObj.down('[name=button_name]').setText('your-text-here');
    Last edited by gameboy87; 15 May 2013 at 10:35 PM. Reason: mentioned wrong window name

  5. #4
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1

    Default

    Hi, Thanks for your reply.

    i got the solution.
    Code:
    var window1Obj = Ext.ComponentQuery.query('firstwindow')[0];  //where firstwindow is userAlias name of Window 1
    
    window1Obj.down('#btn').setText('New text');
    Using window1Obj, we can access any control of window 1.

Posting Permissions

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