DHTMLX Little-Known Features: “Soft-Closed” Windows

| Leave a comment

One more small DHTMLX tip with the help of which you’ll be able to close window (not collapse), but it will be still active and continue working on background.

Why does someone need it? It’ll save you from the necessity to load the definite part of information each time, i.e. the work with your app will render faster.


Click to open live demo

So, to achieve it, we use the following algorithm:

function showWindow(id, text) {
    // step 1 - init windows on first attempt to show window
    if (myWindows == null) {
        myWindows = new dhtmlXWindows();
    // step 2 - check if window already inited
    if (myWindows.window(id) == null) {
        // window not inited yet, init new one and configure
        var w1 = myWindows.createWindow(....);
        // attach closing event, here we will hide
        // window instead of completely closing
        w1.attachEvent("onClose", function(win){
            return false;
    } else {
        // window inited, just show it
    // call init code if any

Here you can find the demo with the whole source code. If you have any questions regarding this tip, feel free to leave it in the comments section below.