Updating multiple rows on a large handsontable loc

2019-09-04 21:58发布

I have a handson table with 300+. It renders quickly. However, if I update one column in all rows like so:

function() {
    console.trace("Start", new Date());
    $scope.myData.forEach(function(elem, idx) {
        elem.properties.myCol = Math.random();
        if (idx % 100 == 0) console.trace("Tick", new Date());
    });
    console.trace("End", new Date());
};

The loop executes in less than a second, but the browser tab locks up and the page does not update for over a minute. Is there some way I can disable handsontable from reading updates to the array and then triggering a manual redraw? Is there any other way to speed this up?

2条回答
Summer. ? 凉城
2楼-- · 2019-09-04 22:14

After updating the handsontable data you can use $('#yourTable').handsontable("render"); To re-render the handsontable manually after any updates to the data. And set observeChanges:false (It is false by default) while creating handsontable to disable automatic re-rendering by handsontable.

查看更多
不美不萌又怎样
3楼-- · 2019-09-04 22:30

The option that was slowing down rendering was columnSorting: true,. Removing this fixed the issue.

查看更多
登录 后发表回答