【问题标题】:Handsontable not showing table with dynamic columnsHandsontable 未显示带有动态列的表
【发布时间】:2018-11-16 12:31:56
【问题描述】:

我正在使用以下代码来显示我的表格:

<hot-table
        settings="{colHeaders: colHeaders, contextMenu: ['row_above', 'row_below', 'remove_row'], afterChange: afterChange,  stretchH: 'all' }" rowHeaders="false"
        datarows="budgetaanvraag.interne_kosten" columns="columns.interne_kosten" class="col s12">
</hot-table>

并具有以下列:

$scope.calcBedrag = function (instance, td, row, col, prop, value, cellProperties) {
    var hoeveelheid = instance.getDataAtRowProp(row, 'hoeveelheid');
    var eenheidsprijs = instance.getDataAtRowProp(row, 'eenheidsprijs');

    td.innerHTML = hoeveelheid * eenheidsprijs;
    Handsontable.renderers.TextRenderer.apply(this, arguments);
};

$scope.columns = {};
$scope.columns.interne_kosten = [
    {
        data: 'naam',
        title: "<b>Interne kosten</b>",
        renderer: 'html',
        width: 100
    },
    {
        data: 'hoeveelheid',
        title: "Hoeveelheid",
        type: 'numeric',
        width: 50
    }, {
        data: 'eenheid',
        title: "Eenheid",
        type: 'numeric',
        width: 100
    }, {
        data: 'eenheidsprijs',
        title: "Eenheidsprijs",
        type: 'numeric',
        width: 50,
        format: '0,0.00'
    },
    {
        data: 'bedrag',
        title: "Bedrag",
        type: 'numeric',
        width: 50,
        format: '0,0.00',
        renderer: $scope.calcBedrag,
        readonly: true
    }
];

但这总是显示一个空表 启用行标题时,它只显示:

这是这里使用的数据:https://gist.github.com/cskiwi/a57de031f752df1182be

【问题讨论】:

    标签: handsontable


    【解决方案1】:

    好的,找出导致错误的原因:

    如果你使用 $scope.columns 它会搞砸事情:)

    【讨论】:

      猜你喜欢
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      • 2021-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-11
      • 2020-03-23
      相关资源
      最近更新 更多