I need to implement Window which can be always on top. How can I to do it? All my tries with WindowManager give me no results :(
Asked
Active
Viewed 1.6k times
8
-
Have a look at this: http://stackoverflow.com/questions/6053847/how-to-make-a-full-modal-window-in-ext-4 – Dave May 03 '12 at 15:03
-
1Take a look at `Ext.ZIndexManager.bringToFront()` method – s.webbandit May 04 '12 at 11:57
-
Check this. http://docs.sencha.com/extjs/5.1.0/api/Ext.window.Window.html#cfg-alwaysOnTop – Arthanari C Apr 12 '17 at 16:30
1 Answers
8
In Ext.window.Window, there's a property called 'modal': set it to true.
Otherwise, use the WindowManager to manage your windows: in this case you have to follow the following steps:
- register your windows to the WindowManager (Ext.WindowManager.register (winId))
- use bringToFront method to set your window on top (Ext.WindowManager.bringToFront (winId))
- finally, check the element on top with the getActive method (Ext.WindowManager.getActive ())
E.g.:
Ext.create ('Ext.window.Window', {
title: 'Your window' ,
width: 300 ,
height: 300 ,
html: 'ciao ciao' ,
modal: true
}).show ();
Or:
var win1 = Ext.create ('Ext.window.Window', {
title: 'Your window' ,
id: 'firstWin' ,
width: 300 ,
height: 300 ,
html: 'ciao ciao' ,
});
win1.showAt (50, 50);
var win2 = Ext.create ('Ext.window.Window', {
title: 'Your window' ,
id: 'secondWin' ,
width: 300 ,
height: 300 ,
html: 'I love pizza' ,
});
win2.showAt (60, 60);
// Register your floating objects (window in this case) to the WindowManager
Ext.WindowManager.register (win1);
Ext.WindowManager.register (win2);
// Bring 'firstWin' on top
Ext.WindowManager.bringToFront ('firstWin');
// Then, check the zIndexStack
alert (Ext.WindowManager.getActive().getId ()); // this is firstWin, the window with the highest zIndex
Hope this help you.
Cyaz

Wilk
- 7,873
- 9
- 46
- 70
-
That's nice, and the **main question** is: **HOW** to detect that new window is showed over the my window? – Guy Fawkes May 11 '12 at 08:45
-
Ah, now I got it ;) Well, first you have to register your windows to the WindowManager. Then, check the zIndexStack of the WindowManager ;) The first element of the stack is that with the highest zIndex. Ext.WindowManager.zIndexStack[0] is your solution but I think the same thing should be done by Ext.WindowManager.getActive() but in my experiments it doesn't work... Now look to my first answer with the entire solution: it's just edited ;) – Wilk May 11 '12 at 09:58
-
1Ok, I just understood how to get the window with the highest zIndex through Ext.WindowManager.getActive(): instead of using toFront() method of each windows, you have to use Ext.WindowManager.bringToFront(id/object) and then check it with Ext.WindowManager.getActive() ;) Look to the edited solution. Ciao! – Wilk May 11 '12 at 10:07
-
`Ext.WindowManager.zIndexStack[0]` is the most bottom component. It is the last element of the array, which is given by `getActive()`. – kirilloid Jul 30 '12 at 08:26
-