AngularJS:无法在handontable

时间:2016-12-21 12:02:52

标签: angularjs handsontable formulas

我正在使用handontable从json预览我的数据,它显示我的数据非常好,但是现在当我尝试在我的表格中使用formulas时它不起作用。意味着每当我输入=SUM(1+1)时,它应该在列中显示结果2,但它只是显示=SUM(1+1)。它没有实现公式,甚至还没有在我的项目中注入rule.js文件。

我的HTML代码:

<md-content class="content" >
   <hot-table settings="{formulas: true, colHeaders: columnsData, stretchH: 'all',filters: true,dropdownMenu: true,manualColumnMove: true, contextMenu: ['row_above', 'row_below', 'remove_row','---------','col_left','col_right','remove_col','---------','undo','redo','---------','make_read_only','alignment'], afterChange: afterChange}"
                       row-headers="false"
                       min-spare-rows="minSpareRows"
                       datarows="vm.items"
                       height="500"
                       width="1255">
         <hot-column data='{{key}}' title="key" type="grayedOut"  ng-repeat="(key, item) in vm.items[0]"></hot-column>
   </hot-table>
</md-content>

我的控制器代码:

api.dataset.getById.get({'id': $state.params.id},
    // Success
    function (response){
        console.log(JSON.stringify(response.records.records));
      vm.items = response.records.records;
      vm.dataset_id = response.records.dataset_id;
    },
    // Error
    function (response){
      console.error(response);
    }
  );

项目JSON:

[
  {
    "employee_id": 110011,
    "employee_name": "Rahul Sharma",
    "department": "PHP",
    "position": "Junior",
    "salary": 10000,
    "company": "oxo"
  },
  {
    "employee_id": 110012,
    "employee_name": "Gobind Rai",
    "department": "PHP",
    "position": "Senior",
    "salary": 10000,
    "company": "oxo"
  },
  {
    "employee_id": 110013,
    "employee_name": "Sandeep Singh",
    "department": "PHP",
    "position": "Fresher",
    "salary": 5000,
    "company": "oxo"
  },
  {
    "employee_id": 110014,
    "employee_name": "Ashish",
    "department": "PHP",
    "position": "Junior",
    "salary": 20000,
    "company": "oxo"
  },
  {
    "employee_id": 110015,
    "employee_name": "Pawan",
    "department": "PHP",
    "position": "Senior",
    "salary": 10000,
    "company": "oxo"
  }
]

示例

enter image description here

我尝试了与此相关的所有事情,但无法使用公式。

0 个答案:

没有答案