Home > OS >  Is there a way to add large amounts of data to Tabulator without freezing?
Is there a way to add large amounts of data to Tabulator without freezing?

Time:07-04

I have a large CSV file, around a 700,000 lines with 20 columns each.

I am streaming the file by each lines and then parsing it in a web worker. The problem is that after I parse each row, I cannot add the row to Tabulator with table.addData. If I pass the parsed data to the main thread, it blocks the page execution.

Is there a way to add the data without blocking the main thread?

CodePudding user response:

You can reduce the frequency to send data back to the main thread. You can send data in chunks.

CodePudding user response:

This suggests that you have not set a height on your Table, therefor the virtual DOM has not been loaded.

In order for the virtual DOM to work and thus process the data in the background, the table must have a height or maxHeight defined.

Though even with that, loading in 700,000 lines will likely cause a pause of a few 100ms as that is a lot of data for anything to process.

You absolutely shouldn't be adding it to Tabulator 1 row at a time, that will definitely slow things down as you are triggering a rerender with each new row. You should parse all the data in one go and then pass it into tabulator as one array of rows to the setData function

  • Related