MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / removeAll

Method removeAll

src/gridstack.ts:1428–1440  ·  view source on GitHub ↗

* Removes all widgets from the grid. * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`). * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).

(removeDOM = true, triggerEvent = true)

Source from the content-addressed store, hash-verified

1426 * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).
1427 */
1428 public removeAll(removeDOM = true, triggerEvent = true): GridStack {
1429 // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently
1430 this.engine.nodes.forEach(n => {
1431 if (removeDOM && GridStack.addRemoveCB) {
1432 GridStack.addRemoveCB(this.el, n, false, false);
1433 }
1434 delete n.el.gridstackNode;
1435 if (!this.opts.staticGrid) this._removeDD(n.el);
1436 });
1437 this.engine.removeAll(removeDOM, triggerEvent);
1438 if (triggerEvent) this._triggerRemoveEvent();
1439 return this;
1440 }
1441
1442 /**
1443 * Toggle the grid animation state. Toggles the `grid-stack-animate` class.

Callers 5

destroyMethod · 0.95
GridStackProviderFunction · 0.45
GridStackRenderProviderFunction · 0.45
clearGridMethod · 0.45
gridstack-spec.tsFile · 0.45

Calls 2

_removeDDMethod · 0.95
_triggerRemoveEventMethod · 0.95

Tested by

no test coverage detected