1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    Valik71 is on a distinguished road

      0  

    Default Unanswered: Determine whether the window is open

    Unanswered: Determine whether the window is open


    PHP Code:
    Ext.onReady(function(){
        
        function 
    getPopup(){    
            var 
    win Ext.create('Ext.window.Window', {
                
    autoShowtrue,
                
    title:'Отчет по задаче',
                
    width450,
                
    height275,        
                
    modal true,
                
    plaintrue,            
                
    icon'../images/error.gif',            
                
    items: {           
                    
    x5y70,
                    
    width 420height90,
                    
    xtype'textarea',            
                    
    fieldLabel'<strong>Внесите отчет</strong>',
                    
    name'text',
                    
    id'tm_text',
                    
    blankText 'Если задача выполнена, то оставьте отчёт. Если не готово, то перенесите дату',
                    
    allowBlankfalse            
                
    }, 
                
    id'getMessage'        
            
    });
            
    console.log(win.getId());          
        }
        
    //console.log(win);
        
        
    if(!Ext.isDefined(win.isVisible)){
            
    setInterval(getPopup10000);
       }
    }); 
    I periodically open windows. The next window should be opened if there is no windows. I can not get out of the confirmation window opens. I tried to use 'isVisible', but there is no object and this method does not work.
    Using ExtJS 4.0.7.
    Sorry my English.

  2. #2
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Assign your Window an itemId:

    Code:
    Ext.create('Ext.window.Window', {
      height: 200,
      itemId: 'myWindow',
      title: 'Test Window',
      width: 300
    }).show();
    You can now check for existence, like so:

    Code:
    var x = Ext.ComponentQuery.query('#myWindow')[0];
    if (x == null) {
        // window doesn't exist.
    }
    else {
       // window exists.
    }
    Last edited by friend; 8 May 2013 at 11:42 AM. Reason: grammar

  3. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    10
    Vote Rating
    0
    Valik71 is on a distinguished road

      0  

    Default


    Thank you I have found a solution
    PHP Code:
    var getMessage Ext.getCmp('getMessage'); //получаем открытое окно
        
    if(!getMessage) {                            // если оно открыто, новых окон не открываем
            
    var win Ext.create('Ext.window.Window', {
               .......
                
    id'getMessage'        
            
    });
        }    
        } 

  4. #4
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    Your solution will work, but hard coded global IDs are frowned upon and can lead to a variety of problems. Use with care! :]

Thread Participants: 1

Tags for this Thread