View Full Version : How can I control relative zIndex of multiple windows?

27 Sep 2013, 3:32 AM
In my product I some times have a number of dialogs that I've created using Ext.window.Window. This works fine when I create new ones because then the latest should always be on top. The problems occur when I reload the browser. Then the creation of the dialogs won't be as controlled and I often end up with a "older" dialog on top. This happens because I recreate all windows based on data I get from the server and all windows open more or less at the same time.

I've started looking into zIndex, but it feels like it would be a bad idea to not use the ZIndexManager for this purpose and that doesn't seem to be easy to do in my scenario.

What I of course could do is the control the order of when I open the windows and make sure that they are created in the correct order, but it would be nice to instead work with a ordering number that is used to determine the zIndex (I get a ordering number from the server for each dialog so I have the required data for this).

So, is there a way to do this through configuration of the window? Or do I have to create a controlled opening loop and if so where do you suggest I place the triggering of the next open (in which event, would beforerender be a good idea or is some other event better)?

30 Sep 2013, 3:41 AM
You can iterate over your windows in proper order and call toFront (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.util.Floating-method-toFront) method.