I want to put an array data in a dropdown with Handsontable. So, I created a little array like this :
var array_dropdown = ['Hello','test','lison','flag'];
And here is my HOT :
var container = document.getElementById('tab_traitement');
var hot = new Handsontable(container, {
data: data_traitement,
minSpareRows: 1,
rowHeaders: false,
colHeaders: false,
contextMenu: true,
height: 300,
width: 810,
colWidths: [200, 200, 200, 200],
cells: function(row, col, prop) {
var cellProperties = {};
if ([0].indexOf(row) !== -1 && col >= 0) {
cellProperties.readOnly = true;
}
return cellProperties;
},
columns: [{}, {}, {}, {
type: 'dropdown',
source: [array_dropdown] //Here, I'm trying to get the array data
}]
});
Can someone help me please ?
In source
option you don't need []
. This will make the array two-dimensional, as array_dropdown
is already an array
.
source: array_dropdown // Don't need `[]` here