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

Method destroy

src/gridstack.ts:1115–1136  ·  view source on GitHub ↗

* Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members. * @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).

(removeDOM = true)

Source from the content-addressed store, hash-verified

1113 * @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).
1114 */
1115 public destroy(removeDOM = true): GridStack {
1116 if (!this.el) return; // prevent multiple calls
1117 this.offAll();
1118 this._updateResizeEvent(true);
1119 this.setStatic(true, false); // permanently removes DD but don't set CSS class (we're going away)
1120 this.setAnimation(false);
1121 if (!removeDOM) {
1122 this.removeAll(removeDOM);
1123 this.el.removeAttribute('gs-current-row');
1124 } else {
1125 this.el.parentNode.removeChild(this.el);
1126 }
1127 if (this.parentGridNode) delete this.parentGridNode.subGrid;
1128 delete this.parentGridNode;
1129 delete this.opts;
1130 delete this._placeholder?.gridstackNode;
1131 delete this._placeholder;
1132 delete this.engine;
1133 delete this.el.gridstack; // remove circular dependency that would prevent a freeing
1134 delete this.el;
1135 return this;
1136 }
1137
1138 /**
1139 * Enable/disable floating widgets (default: `false`). When enabled, widgets can float up to fill empty spaces.

Callers 10

GridStackRenderProviderFunction · 0.45
ngOnDestroyMethod · 0.45
gsCreateNgComponentsFunction · 0.45
cleanDraggableMethod · 0.45
cleanResizableMethod · 0.45
cleanDroppableMethod · 0.45
gridstack-spec.tsFile · 0.45

Calls 5

offAllMethod · 0.95
_updateResizeEventMethod · 0.95
setStaticMethod · 0.95
setAnimationMethod · 0.95
removeAllMethod · 0.95

Tested by

no test coverage detected