Handsontable add row/sort bug
by Camille Bechayda
HTML
<script src="http://handsontable.com/dist/jquery.handsontable.full.js"></script>
<link rel="stylesheet" href="http://handsontable.com/dist/jquery.handsontable.full.css">
<link rel="stylesheet" href="http://handsontable.com/demo/css/samples.css">
<h2>Handsontable add row/sort bug</h2>
<div id="exampleGrid" class="dataTable"></div>
<button id="addRow">Add row</button>
CSS
body {
background-color: white;
margin: 20px;
}
h2 {
margin: 20px 0;
}
JavaScript
var myData = [
{a: false, b: 2, c: 3},
{a: false, b: 10, c: 11},
{a: true, b: 11, c: -4}
];
$("#exampleGrid").handsontable({
data: myData,
minSpareRows: 0,
rowHeaders: true,
colHeaders: ["A", "B", "C"],
columns: [
{ data: "a", type: "checkbox" },
{ data: "b", type: "text" },
{ data: "c", type: "text" },
],
columnSorting: true,
});
$("#addRow").click(function() {
myData.push({a: true, b: 100, c: 1000});
$("#exampleGrid").handsontable("render");
});