Check documentation for the latest version of dhtmlxSuite detachObject DHTMLX Docs

detachObject

detaches any attached content from a tab

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 which parameters we pass to the method.

Assuming that we have attached Grid to the Tabbar's tab:

var myGrid = myTabbar.tabs(id).attachGrid();

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

1) calling the detachObject() method without parameters:

myTabbar.tabs(id).detachObject();

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

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

myTabbar.tabs(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
myTabbar.tabs(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 myTabbar.unload(), the attached content will be removed permanently.

See also
Back to top