Check documentation for the latest version of dhtmlxSuite detachObject DHTMLX Docs

detachObject

detaches any attached content from a window

void detachObject( [boolean remove,string|number|HTMLElement moveTo] );
removeboolean(optional) set to true to remove the content permanently, false by default
moveTostring|number|HTMLElement(optional) the object's id or the object itself to move content to (if the "remove" parameter is set to false)
Details

Let's consider possible behavior, depending on the parameters that we pass to the method.

Assuming that we have attached Grid to a window:

var myGrid = myWins.window(id).attachGrid();

In case we need to detach Grid later, there are several possible options:

1) calling the detachObject() method without parameters:

myWins.window(id).detachObject();

The Grid object won't be completely removed. It will be attached to the document.body outside the component's container and hidden with the display:none property.

2) calling the detachObject() method with the "remove" parameter set to true:

myWins.window(id).detachObject(true);

The cell will be cleared. You need to clear the Grid object to remove it permanently.

myGrid = null;

3) calling the detachObject() method with the "remove" parameter set to false and passing an object (object's id) as the second parameter:

// assuming that a node with the id="tempNode" exists
myWins.window(id).detachObject(false, "tempNode");

The Grid object won't be completely removed. It will be moved to the "tempNode" container and hidden with the display:none property.

Note also that if you call myWins.unload(), the attached content will be removed permanently.

See also
Back to top