Results 1 to 4 of 4

Thread: Reference to parent window

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    41
    Answers
    1

    Default Reference to parent window

    Hi,
    I have a window displaying a list of checkboxes with ok and reset button as dockeditems:

    Code:
      
      var window = Ext.create('mypage.newWindow', {
            
            title: button.parentId.id,
             dockedItems: [{
                 xtype: 'toolbar',
                 dock: 'bottom',
                 items:[{
                  xtype:'button',
                  text:'OK',
                  listeners:{
                  
                  'click':this.handleWindowOk,
                   scope:this
                  }
                 },{
                  xtype:'button',
                  text:'RESET',
                  listeners:{
                  
                  'click':this.handleWindowReset,
                   scope:this
                  }
                 }]
                 
             }],
            
            
            items:[
                   {
                    xtype: 'fieldcontainer',
                          items:WindowItems
                      
             }]
             
             
            
    }).show();

    In the event listeners of handleWindowOk I want to catch the checked items and close the window but I was not able to get a reference to the window container.
    I tried the following approaches :
    Code:
       
    
    handleWindowOk:function(button){
     
      // Approach#1
      //console.log(this.getNewWindow());
      // Approach#2
      var ParentWindow = button.findParentBy(function(container, component) {
                return (container.xtype === 'mypage.newWindow');
             });
      
      console.log(ParentWindow);
      //Approach#3
      //console.log(button.findParentByType('mypage.newWindow'));
      //Approach#4
      //console.log(button.up('Ext.window.Window'));
      //Approach#5
      //console.log(button.up('window[xtype = mypage.newWindow]'));
      //Approach#6
      //console.log(button.up(Ext.window.Window));
      //Approach#7
      console.log(button.up('mypage.newWindow'));
    }
    All the approaches are giving null result.
    The window is not a child nor a sub item of any container.

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    Try button.up('window').

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    41
    Answers
    1

    Default Thanks

    Thanks, That works!!

  4. #4

    Default

    How to get Active window Reference?

Tags for this Thread

Posting Permissions

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