gridstack.js issue base

Use this as a base for examples for gridstack.js issues.

by Alain Dumesny

HTML

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-all.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/gridstack-extra.css">
<h1>gridstack.js base demo for issues</h1>
<p>Fork and modify me to demonstrate your issue when creating an issue for gridstack.js</p>
<div><a class="btn btn-default" onClick="addNewWidget()" href="#">Add Widget</a></div>
<div><a class="btn btn-default" onClick="resizeColumns()" href="#">Resize Columns</a></div>
<br />

<div class="grid-stack"></div>

CSS

.grid-stack {
  background: lightgoldenrodyellow;
  width: 300px;
}

.grid-stack-item-content {
  color: #2c3e50;
  text-align: center;
  background-color: #18bc9c;
}

JavaScript

var options = { // put in gridstack options here
  float: false,
  column: 1,
  disableOneColumnMode: true,
  cellHeight: "100px"
};
var grid = GridStack.init(options);

var count = 0;

addNewWidget = function () {
  var node = {
  	autoPosition: true,
    x: Math.round(12 * Math.random()),
    y: Math.round(5 * Math.random()),
    w: Math.round(1 + 3 * Math.random()),
    h: Math.round(1 + 3 * Math.random())
  };
  node.content = String(count++);
  grid.addWidget(node);
  return false;
};

resizeColumns = function () {
	grid.column(2);
}