Remove panel
Remove panel
A panel can be removed either from its own panel API or from the container API. Removing a panel destroys its instance; the group is removed too once its last panel is gone, unless the closeEmptyGroups option is false.
Remove a panel using the Panel API
close |
|
|---|
Calling close on the panel API is the easiest way to close a panel through code.
panel.api.close();
Remove a panel using the API
removePanel | Remove a panel given the panel object.
removeEmptyGroup overrides the closeEmptyGroups option for this
call: false keeps the group if the panel was its last one, true
removes it.
|
|---|
Firstly, you can retrieve a reference to the panel given its id and then you can
pass that reference into removePanel to remove the panel.
const panel: IDockviewPanel = api.getPanel('myPanel');
api.removePanel(panel);
// keep the group even if this was its last panel
api.removePanel(panel, { removeEmptyGroup: false });
See also
- Adding panels: the counterpart for creating panels.
- Move panel: relocate a panel instead of destroying it.
- Panel API: the full set of per-panel methods, including
close.