Hybrid View
-
30 Jul 2012 8:53 AM #1
ext.window close automatically... is it possible in extjs 3.4??
ext.window close automatically... is it possible in extjs 3.4??
Hello Experts

I was wondering if it is possible to close automatically an ext.window, if so, I'd appreciate your suggestions to do this. I have this code:
this window appears after pressing a button and would like that it closes automatically after 10 seconds for example. Is that possible?Code:welcomeWin = new Ext.Window( { border: false, resizable: false, draggable: false, closable: false, layout: 'fit', autoWidth: true, autoHeight: true, items: [welcomePanel] } );
please let me know.
Best regards,
Gery
-
30 Jul 2012 12:57 PM #2
Code:var mywindow=new Ext.Window({ title:'My Window Title', items:someitems, width:500, height:300, autoScroll:true, listeners:{ show: function() { setTimeout("mywindow.close()", 10*1000); } } })
-
31 Jul 2012 10:37 AM #3
Thanks Jennifer123 for the code but the window is still there, this is my code:
what it actually does is basically triggering the printPanel after pressing the button. Using the listener it should close the window after 10 seconds, I'm almost sure it is in the wrong position, but I put it inside the () in the this.printpanelWin.show(); and didn't work either.Code:var action = new Ext.Action( { handler: function() { if (this.pressed) { if (!this.printpanelWin) { this.printpanelWin = new Ext.Window( { border: false, resizable: false, draggable: false, closable: false, layout: 'fit', autoWidth: true, autoHeight: true, x: 141, y: 28, items: [printPanel], listeners:{ show: function() { setTimeout("mywindow.close()", 10*1000); } } } ); } this.printpanelWin.show(); } else { this.printpanelWin.hide(); } }, } );
Any support is appreciated.
Best regards,
-
31 Jul 2012 11:44 AM #4
Well it works for me. Can you try the following
- I see this.printpanelWin.hide(), try replacing close() with hide() or destroy(). (I hope you changed mywindow to this.printpanelWin
) - If the window still does not close, replace this.printpanelWin.close() with alert(1) and see if you see the alert message after 10 seconds.
- I see this.printpanelWin.hide(), try replacing close() with hide() or destroy(). (I hope you changed mywindow to this.printpanelWin
-
31 Jul 2012 12:41 PM #5
lapsus brutus... thanks for pointing that out Jennifer, I forgot to replace the mywindow.close, but still it is not working, this is what I tried recently:
when I used this.printpanelWin.alert(1), it appeared this error in firebug: "this.printpanelWin is undefined", this appears exactly after 10 secondsCode:var printpanelWin = null; action = new Ext.Action( { handler: function() { if (this.pressed) { if (!this.printpanelWin) { this.printpanelWin = new Ext.Window( { border: false, resizable: false, draggable: false, closable: false, layout: 'fit', autoWidth: true, autoHeight: true, x: 141, y: 28, items: [printPanel], listeners:{show: function() {setTimeout("this.printpanelWin.destroy()", 10*1000);}} } ); } this.printpanelWin.show(); } else { this.printpanelWin.hide(); } } });
, the same if I delete "this", so it's working!
it's definitely getting somewhere
, thanks Jennifer for your nice support and neat mood 
-
31 Jul 2012 1:59 PM #6
If the code was setTimeout("alert(1)",..., then it would have worked fine without the error. However, since the error happened after 10 seconds that means that setTimeout is working. It's just a matter of closing the window now.
I am not sure but maybe using 'this' is causing the issue. When I tried it with 'this' it gave me an error 'this.mywindow is undefined'. Is it possible for you to remove 'this.' from your window name? Let me know


Reply With Quote