下拉列表中的数组(Handsontable)

Array in dropdown (Handsontable)

我想使用 Handsontable 将数组数据放入下拉列表中。所以,我创建了一个像这样的小数组:

var array_dropdown = ['Hello','test','lison','flag'];

这是我的热门:

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
    }]

});

有人可以帮我吗?

source 选项中你不需要 []。这将使数组成为二维数组,因为 array_dropdown 已经是一个 array.

source: array_dropdown // Don't need `[]` here