loadData Issue

Tags: #<Tag:0x00007f0afe85d8f0>

Hi,

After getting results from filtered data am not able to undo. Here for rendering data am using loadData().
If I use setDataAtCell() it takes too much time.

I need any alternate solution for this.

Hi @kunal

When you load a new dataset via loadData() your undo is reset. This behavior can be tested here https://jsfiddle.net/7ry08ac5/

I imagine that you use loadData() as besides one setDataAtCell you also perform some operations that are heavy for the browser. Can please list the logic that you attach to setDataAtCell?

Thanks for your response.

Please find the attached file for reference.

Here I mentioned two methods for loading data after executing the formula.

  1. table.loadData() - This is very fast but can’t undo data after executing formulas( Highlighted with yellow color)

  2. Using setDataAtCell() - This method allows us to perform undo. but takes huge time for large data, also does undo action one by one. ( Highlighted with red color)

What we expect - After executing formulas, load data immediately, and once we do undo, revert it to the previous state.

Thank you for the screenshot. Have you tried using batching to speed up that map function?

Tutorial: https://handsontable.com/docs/8.3.1/tutorial-suspend-rendering.html
Change: You just need to wrap the unique.map function in an instance.batch() method.

table.batch(() => {
  unique.map((value, index ) => {
    table.setDataAtCell(index, parseInt(colIndex), value);
  })
});