javascript - 使用本地数据加载handsontable失败

标签 javascript handsontable

我正在尝试使用http://jsfiddle.net/kc11/y66uc1cq/加载一些我已包含在可手动 View 中的数据。虽然JS是有效的:

$(document).ready(function () {

    function getCarData() {
        return [
        ["Nissan", 2009, "black", "black"], ["Nissan", 2006, "blue", "blue"], ["Chrysler", 2004, "yellow", "black"], ["Volvo", 2012, "white", "gray"]];
    }

    var data = [
        ["", "Kia", "Nissan", "Toyota", "Honda"],
        ["2008", 10, 11, 12, 13],
        ["2009", 20, 11, 14, 13],
        ["2010", 30, 15, 12, 13]
    ];




    $("#example1").handsontable({
        data: data,
        minRows: 5,
        minCols: 6,
        minSpareRows: 1,
        currentRowClassName: 'currentRow',
        currentColClassName: 'currentCol',
        autoWrapRow: true,
        rowHeaders: true,
        colHeaders: true
    });


    $("#example1").handsontable('selectCell', 3, 3);





});

没有发生负载。为什么以及如何解决这个问题?

最佳答案

很难测试,因为 fiddle 中的所有引用都已损坏,但请尝试以下操作:

var table = new Handsontable($("#example1"), {
    data: data,
    minRows: 5,
    minCols: 6,
    minSpareRows: 1,
    currentRowClassName: 'currentRow',
    currentColClassName: 'currentCol',
    autoWrapRow: true,
    rowHeaders: true,
    colHeaders: true
});
table.render();

来源:http://handsontable.com/demo/understanding_reference.html

关于javascript - 使用本地数据加载handsontable失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27724738/

相关文章:

javascript - 获取类型错误 : undefined is not a function on handsontable. validateCells()

javascript - 单击外部按钮/下拉菜单时,下拉菜单不会关闭

javascript - 使用 Javascript (ES6) 删除元素中的第一个字母

javascript - 更新 Handsontable 中的特定单元格

javascript - VueJS 中的 Handsontable,表格仅在页面重新加载时加载

ruby-on-rails - 如何将 Handsontable 与 ruby​​ on Rails 集成?

javascript - 如何将json数据加载到handsontable中

php - 从 HTML 调用 Javascript 函数

javascript - 如何在浏览器的新选项卡中打开页面?

javascript - 将 video.js 集成到 Angular Web 应用程序中