gpt4 book ai didi

angularjs - 使用 nghandsontable 访问 Handsontable 方法/属性

转载 作者:行者123 更新时间:2023-12-02 13:59:17 24 4
gpt4 key购买 nike

我正在使用ngHandsontable Handsontable 的 Angular 指令。我成功地显示了数据,但我正在努力访问修改后的行,以便将数据发送到数据库。
我尝试绑定(bind) afterChange 回调,但索引似乎在列排序后关闭。 (显示表中显示的行的索引,而不是数据源中的行的索引)

我想知道保存 ngHandsontable 数据的最佳实践是什么,或者我应该如何访问 getData 方法或 columnSorting 属性等 API

非常感谢您的帮助!- 马可

最佳答案

我最终使用 afterInit 事件来获取实例,然后在 afterChange 等进一步事件中调用方法。

这就是我的代码的样子:

afterInit: function() {
$scope.hot.instance = this;
}

然后:

afterChange: function (changes, source) {
if (source != 'loadData') {
var hot = $scope.hot.instance;
var dataRow = hot.getSourceDataAtRow(index)
// .... saveChanges...
};
}

非常感谢 Bricktop 给我的提示。

关于angularjs - 使用 nghandsontable 访问 Handsontable 方法/属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28330340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com