You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well I have a situation that need to add/remove editable columns dynamically by checkboxes. So when a checkbox be checked, i would add the column to table, and set empty/default value to editable cells of this column. Otherwise remove the column from table and get rid of field from data.
My solution
I have a table component based on react-table
Pass columns and data into table component from higher component
Set Cell for columns in useMemo in table component like the pic below (I hid some sensitive codes in the pic, most of those cases set Cell as CustomTextField, CustomTextField is a customize input component which is based on TextField)
When adding/removing columns, i handle data and columns in higher component, and pass them into table component
Issue
Seems if there are many rows, and when i added more columns, it would render soooo slowly.
But if I replaced the CustomTextField with <input /> it would be a little faster.
If I replaced CustomTextField with other uneditable components (like Typography), it would be normal.
What I need
I wanna know the reason about this issue
How can I resolve this performance issue
@tannerlinsley could you take a look if available? Thx.
If someone else knows how to resolve it or improve the performance, let me know pls. Thx in advance!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
UI Lib
Version
Scenario
Well I have a situation that need to add/remove editable columns dynamically by checkboxes. So when a checkbox be checked, i would add the column to table, and set empty/default value to editable cells of this column. Otherwise remove the column from table and get rid of field from data.
My solution
react-table
columns
anddata
into table component from higher componentCell
for columns inuseMemo
in table component like the pic below (I hid some sensitive codes in the pic, most of those cases setCell
asCustomTextField
,CustomTextField
is a customize input component which is based onTextField
)data
andcolumns
in higher component, and pass them into table componentIssue
CustomTextField
with<input />
it would be a little faster.CustomTextField
with other uneditable components (likeTypography
), it would be normal.What I need
@tannerlinsley could you take a look if available? Thx.
If someone else knows how to resolve it or improve the performance, let me know pls. Thx in advance!
Beta Was this translation helpful? Give feedback.
All reactions