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

Method setStatic

src/gridstack.ts:1470–1481  ·  view source on GitHub ↗

* Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on. * Also toggle the grid-stack-static class. * @param val if true the grid become static. * @param updateClass true (default) if css class gets updated * @p

(val: boolean, updateClass = true, recurse = true)

Source from the content-addressed store, hash-verified

1468 * @param recurse true (default) if sub-grids also get updated
1469 */
1470 public setStatic(val: boolean, updateClass = true, recurse = true): GridStack {
1471 if (!!this.opts.staticGrid === val) return this;
1472 val ? this.opts.staticGrid = true : delete this.opts.staticGrid;
1473 this._setupRemoveDrop();
1474 this._setupAcceptWidget();
1475 this.engine.nodes.forEach(n => {
1476 this.prepareDragDrop(n.el); // either delete or init Drag&drop
1477 if (n.subGrid && recurse) n.subGrid.setStatic(val, updateClass, recurse);
1478 });
1479 if (updateClass) { this._setStaticClass(); }
1480 return this;
1481 }
1482
1483 /**
1484 * Updates the passed in options on the grid (similar to update(widget) for for the grid options).

Callers 3

destroyMethod · 0.95
updateOptionsMethod · 0.95
gridstack-spec.tsFile · 0.80

Calls 4

_setupRemoveDropMethod · 0.95
_setupAcceptWidgetMethod · 0.95
prepareDragDropMethod · 0.95
_setStaticClassMethod · 0.95

Tested by

no test coverage detected