【发布时间】:2015-11-15 04:34:22
【问题描述】:
我的代码看起来像这样,但我仍然无法计算总和值。谁能帮我解决这个问题。我想在 C 列中添加 a 和 b 的值。但我得到的输出是 SUM(A1:B1)。
Can anyone tel me how to solve this?The same code works fine in when done using Jquery.
<script src="handsontable.full.js" type="text/javascript"></script>
<link href="handsontable.full.css" rel="stylesheet" type="text/css">
<script src="angular.js" type="text/javascript"></script>
<script src="ngHandsontable.js" type="text/javascript"></script>
<script>
var app = angular.module('myApp', ['ngHandsontable']);
app.controller('myCtrl', function($scope) {
$scope.tabledata=[ {a:'73903', b:'15015', c:'=SUM(A1:B1)'},
{a:'73904', b:'15013', c:'=SUM(A2:B2)'},
{a:'73905', b:'15014', c:'=SUM(A3:B3)'}
];
$scope.gridOptions = {
data: 'tabledata'
};
$timeout(function(){
tableInstance.updateSettings({formulas: true});
tableInstance.render();
},10);
});
</script>
**THE HTML CODE**
<div style="position: relative;" data-ng-controller="myCtrl">
<hot-table
hotInstance="tableInstance"
formulas="true"
colHeader="true"
rowHeaders="false"
contextMenu="false"
datarows="tabledata"
colWidths="[100,100,100]">
<hot-column data="a" title="'A'" ></hot-column>
<hot-column data="b" title="'B'"></hot-column>
<hot-column data="c" title="'Total'"></hot-column>
</hot-table>
</div>
【问题讨论】: