Error placing a Window

Hi all,

I’m using the library dhtmlx.js because I use some of the components, and when I place a window on my page, in FireFox works perfectly, but in IE says that there’s an invalid object.

I have found that this happens in the below piece of code:

this._engineRedrawWindowPos = function(win) {
if (win._isFullScreened)return;
win.style.left = win.x + “px”;
win.style.top = win.y + “px”;
};

In particular the win.style.left = win.x + “px”; and win.style.top = win.y + “px”;

Do you know how this coudl fixed?

Thanks in advance for your help.
JuanMa

Hi,

have you got any sample that allows to recreate the problem locally ?

Hi Alexandra,

Find below the piece of code that calls the DHTMLX components and causes the error:

dhtmlxEvent(window,“load”,function(){

    dhxWins = new dhtmlXWindows();
    dhxWins.setImagePath("stylesheets/imgs/");
        
    //var dhxLayout = new dhtmlXLayoutObject("Headers", "2E");
    
    dhxLayout = new dhtmlXLayoutObject(dhxWins.createWindow({id:"wl", center:true, width:200, height:200}), "2E");
    dhxWins.window("wl").setText("Label Refs Status");
            
    dhxLayout.setEffect("resize", true);
    dhxLayout.cells("b").attachObject(document.getElementById("details"));
    dhxLayout.cells("a").dhxcont.mainCont.style.overflow="auto"; 
    dhxLayout.cells("b").dhxcont.mainCont.style.overflow="auto"; 
    dhxLayout.cells("a").hideHeader();
    dhxLayout.cells("b").hideHeader();
    
    var toolbar = dhxLayout.cells("a").attachToolbar();  
    toolbar.setIconsPath("stylesheets/imgs/");
    toolbar.addButton("add", 0, "Add New Row", "plus1.gif", "plus1.gif");
    toolbar.addButton("remove", 1, "Remove Row", "minus1.gif", "imgs/minus1.gif");
    toolbar.attachEvent("onClick", function(id) {
        switch(id)
        {
            case "add":
                grid_header.addRow("nil", ["New"]);
                break;
            case "remove":
                grid_header.deleteRow(grid_header.getSelectedRowId())
                break;
        }
    });
    
    toolbar_T = dhxLayout.cells("b").attachToolbar();  
    toolbar_T.setIconsPath("stylesheets/imgs/");
    toolbar_T.addButton("add", 0, "Add New Row", "plus1.gif", "plus1.gif");
    toolbar_T.addButton("remove", 1, "Remove Row", "minus1.gif", "imgs/minus1.gif");
    toolbar_T.attachEvent("onClick", function(id) {
        switch(id)
        {
            case "add":
                grid_detail.addRow("nil", ["New"]);
                break;
            case "remove":
                grid_detail.deleteRow(grid_detail.getSelectedRowId())
                break;
        }
    });

    var grid_header = dhxLayout.cells("a").attachGrid();
    grid_header.setImagePath("stylesheets/imgs/");
    grid_header.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter");
    grid_header.setSkin("dhx_skyblue");
    grid_header.enableMultiselect(true);
    grid_header.setColSorting("str,str,str,str,str,str,str,str,date,str,int,int,str,int,int,str");
    grid_header.attachEvent("onRowSelect", doOnRowSelected);

            
    grid_header.customGroupFormat = function(text, count) {
        return "Grouped by " + text + ", there are " + count + " related records";           
    };
   
    grid_header.loadXML("/headers/xml");      

    grid_header.enableSmartRendering(true);
    
   
    DataProcessor_LabelRef = new dataProcessor("/headers/update");
    DataProcessor_LabelRef.init(grid_header);
    
    //Set Window maximized on header div
    dhxWins.window("wl").setDimension(parseInt(document.getElementById('header').offsetWidth,10), parseInt(document.getElementById('header').offsetHeight,10));
    dhxWins.window("wl").center();
    
    dhxLayout.cells("a").setHeight(parseInt(document.getElementById('primaryContent').offsetHeight/3,10));
   
    document.getElementById('primaryContent').style.height = dhxWins.window("wl").getDimension()[1] +'px';
    
    dhxWins.window("wl").setMaxDimension(document.getElementById('primaryContent').offsetWidth, 10000);
    dhxWins.window("wl").setMinDimension(document.getElementById('primaryContent').offsetWidth, 0);

    dhxWins.attachEvent("onResizeFinish", function(wl){
        var w_d = dhxWins.window("wl").getDimension();
        document.getElementById('primaryContent').style.height = w_d[1] +'px';
    });   
    
   
    
});

Thanks and Regards
JuanMa

Hi,

you incorrectly use createWindow method. The method gets 5 arguments:

  • id,
  • left,
  • top,
  • width
  • height

And you pass only one - object that contains several elements.
try to use

dhxLayout = new dhtmlXLayoutObject(dhxWins.createWindow(“wl”,10,10,200,200), “2E”);

instead of

dhxLayout = new dhtmlXLayoutObject(dhxWins.createWindow({id:“wl”, center:true, width:200, height:200}), “2E”);

to solve the problem

Thanks Alexandra,

It works.

Best Regards
JuanMa