I am attempting to get the source data object from a "handsontable" using .getSourceData method. The console logs an array of arrays if I call the method using no optional parameters however when I attempt to pass these parameters I get console errors. I have a Fiddle that works to output array but does not work if I uncomment the optional parameter method.
var data = [
[0, 0, 0],
[10, 0.1, 150],
[20, 0.2, 151]
]
var container1 = document.getElementById('Table'),
hot1;
var hot1 = new Handsontable(container1, {
data: data,
colHeaders: ['Measured Depth', "Inclination", "Azimuth"],
rowHeaders: true,
minSpareRows: 0,
contextMenu: ['row_above', 'row_below', 'remove_row']
});
function countRows() {
var ht = hot1
var rowcount = ht.countRows() - ht.countEmptyRows();
return rowcount;
}
console.log(countRows())
function submitForm() {
var htContents = hot1.getSourceData() //getSourceData(1,1,countRows(),3)
console.log(htContents);
}
$("#get_data").click(submitForm);
I never got that function to work however what did work is to use countRows() to limit my output from returning blanks ie
for (i = 0; i < countRows(); i++) {
md.push(htContents[i][0]);
inc.push(htContents[i][1]);
azi.push(htContents[i][2]);
}