* 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)
| 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). |
no test coverage detected