【发布时间】:2017-11-03 07:33:24
【问题描述】:
我使用handsontable 作为位于网络服务器上的MySQL 数据库的前端。用户对前端handsontable上的数据进行过滤、排序、修改等。
由于各种原因,后端 MySQL 数据库发生变化。我需要将此信息同步回用户前端。
我可以使用 HTTP 请求轻松地做到这一点,从数据库中重新下载数据,并使用以下代码 sn-p 将此数据写入 handsontable。
$http({
method: "POST",
url: "my-data-url",
data: "my-post-data"
}).then(function(response){
// response contains the handsontable data
var json_response = response.data;
// Update the data in my table instance
hot.updateSettings({
data: json_response
})
// hot looses its sort and filter conditions...
// how can I maintain these or re-apply them??
});
问题是这段代码清除了所有用户当前的排序和过滤条件。当可动手做的数据对象更新时,我想在哪里保留这些。有谁知道我如何做到这一点?
【问题讨论】:
标签: javascript angular handsontable