2015-08-28 62 views
0

表所以我用下面的代碼,以顯示我的表:Handsontable不顯示動態colums

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

,並與下面的colums:

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

但這始終保持其示出空表 當啓用它只顯示的行標題時: enter image description here

這是這裏使用的數據:https://gist.github.com/cskiwi/a57de031f752df1182be

回答

0

好發現什麼導致錯誤:

如果您使用$ scope.columns它弄亂的東西:)