PDA

View Full Version : Z-index issue with multiple DHTML windows already open



shifty
04-16-2009, 04:53 PM
1) Script Title: Dhtml window widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem: First off, love the script - very light and easy to implement!

I'm using the script to load popup windows from an ajax loaded control panel area, via links in numerous datagrids. At times the user will click on a link which opens a popup window, and in that window has a link which pops up a second window (referenced from the parent window, so they are parallel).

My first issue was that if a user opens 1 window, then opens the second, at times the second would show up under the first - this was fixed by calling the show() function any time a window is loaded. It does not work, however, when they are continuously called in succession.

For example:
If a user clicks on link #1, which opens window #1, then clicks on link #2, which opens link #2, the #2 window now shows on top of all, which is correct. If, however, #1 and #2 are open together, and the user clicks on another link in the parent window which would normally open window #1, the content in window #1 changes but it does not increment the window #1 z-index and remains hidden behind window#2. If you click on the drag bar, it focuses correctly, of course - but unless you close #2, or click on the drag bar of #1, #1 will remain behind #2.

Is there an easy way of incrementing the z-index of a window any time it is called, regardless if it exists or not, to insure that they are always incremented to the top of the z-index list?

ddadmin
04-17-2009, 08:35 AM
Hmm, you say:


If a user clicks on link #1, which opens window #1, then clicks on link #2, which opens link #2, the #2 window now shows on top of all, which is correct. If, however, #1 and #2 are open together, and the user clicks on another link in the parent window which would normally open window #1, the content in window #1 changes but it does not increment the window #1 z-index and remains hidden behind window#2. If you click on the drag bar, it focuses correctly, of course - but unless you close #2, or click on the drag bar of #1, #1 will remain behind #2.

The part in bold- are you calling open() or show() to open the same window again? Both functions when run does increment the z-index value of the DHTML window in question, so there shouldn't be an issue. FYI the method that sets the focus is the following:


dhtmlwindow.setfocus(t)

Where "t" should be the variable referencing the DHTML window in question when you initialized it. If all else fails, you can try manually calling this method inside your triggering link.

shifty
04-21-2009, 07:44 PM
Yep - I am using dhtmlwindow.open() when calling the page, and thought it should increment correctly, but it does not. Additionally, if I open window 1, then open window 2, then focus on window 1 and attemp to open window 2 again (even though it is open and in the background, it should technically increment and bring it to the foreground) and it does not.

Am I correct in assuming that is how it should function?

ddadmin
04-22-2009, 05:26 PM
Hmm testing the issue using the 4 DHTML windows on the demo page (http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/demo.htm), I can't replicate the problem. I've set Demo #3 and #4 to open automatically when the page loads (similar to #1 and #2 by default), then switched between clicking the "Open/Create DHTML window 3" and "Open/Create DHTML window 4" links. In each case, the focus is set to the correct window...

shifty
04-23-2009, 08:22 PM
Curious!

Without them open, I click on a link to open #1 and it is in focus. Leaving #1 open, I click on #2, and that is now in focus. If I click on #1 again, the window refreshes but does not focus. I can replicate in Chrome, IE and FF.

Strange!