If I change 1 dropdown then all the remaining rows will have the same value.
var $container = $(".spreadsheet_div_" + package_id);
$container.handsontable({
data: res,
rowHeaders: true,
minSpareRows: 0,
contextMenu: false,
startRows: qty,
startCols: length,
colHeaders: result.field_headers,
colWidths: result.field_widths,
columns: result.field_type
});
here's a sample output image. http://postimg.org/image/83e9zoak3/
here's the sample console logs. data arrays
Here is the jsfiddle: https://jsfiddle.net/fatluke/ao45uhzn/
Ok, thanks for posting the jsfiddle. Here is your issue:
As you may or may not know, in JS, when you declare an array, each element in the array is a reference to an object. If you were pushing integers, it's not an issue since you will be referencing a new integer each time.
However, in your parse JSON method, you were pushing the same object reference to the data array multiple times. I don't know why you'd push the same data over and over in the first place, but if you wanted to do it, you need to CLONE the object each time.
What is happening is that every row has the same reference to the original data object. When you make a modification in handsontable, it modifies the only object all your elements points to, hence modifying every row.
Again, a simple solution is to clone the object before pushing it. Otherwise, you will have this funny looking behavior.
EDIT:
To test this (I already did and it works) just supply your data
array with copy pasted data and change the loop in the JSON method to data[i] instead of data[0]. You'll see it now works fine.