There is a table of data. There is a script to filter columns, selecting the checkbox to the column name is removed from the table or there depending on check box or not. Here is the code:
var HIDDING_ROWS = [];
var show = function () {
var hot = $("#exempel").handsontable('getInstance');
var newColumns = $.extend(true, [], columns_personage);
var newHeaders = $.extend(true, [], header_personage);
for (var i = 0; i < HIDDING_ROWS.length; i++) {
for (var j = 0; j < newColumns.length; j++) {
if (HIDDING_ROWS[i] === newColumns[j].data) {
newColumns.splice(j, 1);
newHeaders.splice(j, 1);
}
}
}
hot.updateSettings({
columns: $.extend(true, [], newColumns),
colHeaders: $.extend(true, [], newHeaders)
});
hot.render();
};
$('.checkbox-inline input').change(function () {
var value = $(this).prop('checked');
var className = $(this).attr('class');
if (value) {
HIDDING_ROWS.push(className);
show();
}
else {
var index = HIDDING_ROWS.indexOf(className);
if (index < 0)return;
HIDDING_ROWS.splice(index, 1);
show();
}
});
After removal of the column I am trying to get the data in the table:
var row = $("#exempel").data('handsontable');
var tableData = row.getData();
And I get an object which has the properties which belong to the columns of which I deleted. How to get the data without the properties are retired (disappeared) from the table?