DHTMLX Docs & Samples Explorer

detachObject(remove, moveTo)

Required library edition: This method works with any edition of DHTMLX library
Required library file: dhtmlxcontainer.js

detaches the object from a cell (the object is moved to document.body, also style “display:none;” is automatically added).

  • remove - (boolean) if the parameter is set to false the specified cell object will be hidden and moved to the document body. Set the parameter to true to remove and delete the cell object from the frame (and release the memory). The default value is false.
  • moveTo - (string, object) a DOM element or its id that the specified cell object will be moved to if the remove parameter is false.

Create object

    <div id="myObj"> </div>

Init Layout, attach object to cell “a”

    var dhxLayout = new dhtmlXLayoutObject(document.body, "3L");
    dhxLayout.cells("a").attachObject("myObj");

Detach object

    dhxLayout.cells("a").detachObject();
    // object attached to document.body now
    // attach to another cell
    dhxLayout.cells("b").attachObject("myObj");

This approach can also be used for accordion, tabbar and windows items.