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

Method column

src/gridstack.ts:1041–1068  ·  view source on GitHub ↗

* Set the number of columns in the grid. Will update existing widgets to conform to new number of columns, * as well as cache the original layout so you can revert back to previous positions without loss. * * Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11] columns,

(column: number, layout: ColumnOptions = 'moveScale')

Source from the content-addressed store, hash-verified

1039 * grid.column(1);
1040 */
1041 public column(column: number, layout: ColumnOptions = 'moveScale'): GridStack {
1042 if (!column || column < 1 || this.opts.column === column) return this;
1043
1044 const oldColumn = this.getColumn();
1045 this.opts.column = column;
1046 if (!this.engine) {
1047 // called in constructor, noting else to do but remember that breakpoint layout
1048 this.responseLayout = layout;
1049 return this;
1050 }
1051
1052 this.engine.column = column;
1053 this.el.classList.remove('gs-' + oldColumn);
1054 this._updateColumnVar();
1055
1056 // update the items now
1057 this.engine.columnChanged(oldColumn, column, layout);
1058 if (this._isAutoCellHeight) this.cellHeight();
1059
1060 this.resizeToContentCheck(true); // wait for width resizing
1061
1062 // and trigger our event last...
1063 this._ignoreLayoutsNodeChange = true; // skip layout update
1064 this._triggerChangeEvent();
1065 delete this._ignoreLayoutsNodeChange;
1066
1067 return this;
1068 }
1069
1070 /**
1071 * Get the number of columns in the grid (default 12).

Callers 4

checkDynamicColumnMethod · 0.95
updateOptionsMethod · 0.95
onResizeMethod · 0.95
gridstack-spec.tsFile · 0.80

Calls 6

getColumnMethod · 0.95
_updateColumnVarMethod · 0.95
cellHeightMethod · 0.95
resizeToContentCheckMethod · 0.95
_triggerChangeEventMethod · 0.95
columnChangedMethod · 0.80

Tested by

no test coverage detected