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

Method removeAll

src/gridstack-engine.ts:816–824  ·  view source on GitHub ↗

* Remove all nodes from the grid. * * @param removeDOM if true (default), marks all nodes for DOM removal * @param triggerEvent if true (default), triggers removal events * @returns the engine instance for chaining * * @example * engine.removeAll(); // Remove all nodes

(removeDOM = true, triggerEvent = true)

Source from the content-addressed store, hash-verified

814 * engine.removeAll(); // Remove all nodes
815 */
816 public removeAll(removeDOM = true, triggerEvent = true): GridStackEngine {
817 delete this._layouts;
818 if (!this.nodes.length) return this;
819 removeDOM && this.nodes.forEach(n => n._removeDOM = true); // let CB remove actual HTML (used to set _id to null, but then we loose layout info)
820 const removedNodes = this.nodes;
821 this.removedNodes = triggerEvent ? removedNodes : [];
822 this.nodes = [];
823 return this._notify(removedNodes);
824 }
825
826 /**
827 * Check if a node can be moved to a new position, considering layout constraints.

Callers

nothing calls this directly

Calls 1

_notifyMethod · 0.95

Tested by

no test coverage detected