AllenFang / AllenFang/react-bootstrap-table

Performance tip for big tables

Aperta
#1,604 5 commenti 1 reazione 0 assegnatari Vedi su GitHub
react-bootstrap-table2
Lingua principale
JavaScript
Stelle
2.2k
Fork
761
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.