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

Method batchUpdate

src/gridstack-engine.ts:85–100  ·  view source on GitHub ↗

* Enable/disable batch mode for multiple operations to optimize performance. * When enabled, layout updates are deferred until batch mode is disabled. * * @param flag true to enable batch mode, false to disable and apply changes * @param doPack if true (default), pack/compact nodes when

(flag = true, doPack = true)

Source from the content-addressed store, hash-verified

83 * engine.batchUpdate(false); // Apply all changes at once
84 */
85 public batchUpdate(flag = true, doPack = true): GridStackEngine {
86 if (!!this.batchMode === flag) return this;
87 this.batchMode = flag;
88 if (flag) {
89 this._prevFloat = this._float;
90 this._float = true; // let things go anywhere for now... will restore and possibly reposition later
91 this.cleanNodes();
92 this.saveInitial(); // since begin update (which is called multiple times) won't do this
93 } else {
94 this._float = this._prevFloat;
95 delete this._prevFloat;
96 if (doPack) this._packNodes();
97 this._notify();
98 }
99 return this;
100 }
101
102 // use entire row for hitting area (will use bottom reverse sorted first) if we not actively moving DOWN and didn't already skip
103 protected _useEntireRowArea(node: GridStackNode, nn: GridStackPosition): boolean {

Callers 2

compactMethod · 0.95
columnChangedMethod · 0.95

Calls 4

cleanNodesMethod · 0.95
saveInitialMethod · 0.95
_packNodesMethod · 0.95
_notifyMethod · 0.95

Tested by

no test coverage detected