setActive()
brings a specific window to the foreground by setting it to the active state
setActive(): void;
In the following example the second window overlaps the first one on initialization, but the call of setActive() allows bringing the first window back to the front.
Example
const windowConfig = {
width: 300,
height: 300,
html: "<div style='padding: 20px'>Window content</div>"
};
const window1 = new dhx.Window({
...windowConfig,
title: "Window 1",
});
const window2 = new dhx.Window({
...windowConfig,
title: "Window 2",
});
// displaying both windows
window1.show();
window2.show(); // Window 2 is currently on top
// bringing Window 1 to the front without refreshing its content
window1.setActive();
The main benefit of this method is that the activation occurs without re-rendering the content, which ensures that the DOM state, such as form input values, scroll positions, or media playback remains completely intact.
Change log:
Added in v9.3
Related sample: Window. Setting the active state
Related article: Work with Window