AllenFang / AllenFang/react-bootstrap-table

Performance tip for big tables

Offen
#1,604 5 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
react-bootstrap-table2
Vorherrschende Sprache
JavaScript
Sterne
2.2k
Forks
761
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

For anyone wanting their table to perform faster!

TLDR: precalculate your dataFormat functions!

I have a complex table with hundreds or thousands of rows and most of the columns have a dataFormat function.

So when the bootstrap table is rendered, a huge number of function calls are executed whilst each row is rendered, and each row needs to go and recalculate the dataFormat function for each cell.

It is less work for the react bootstrap table if you create your table data first, transform all the data into the state that you want it to be, then give it to react-bootstrap-table to render, ideally with no dataFormat column functions.

If the table is rerendered alot this will make it much faster.

I have also asked Allen if it is possible to put JSX into the data field instead of a string. This will make it possible to prerender the component that goes into each cell and then bootstrap table just needs to render it. This would allow for further optimization.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.