How to make flexible row height in FixedDataTable from Facebook?

That's it. I have a lot of data and I can't know what height should i use. Is there anyway to make height flexible? I've heard about RowHeightGetter, but i don't know how to use it. Can u give me some example? Thank you

Upvotes: 2

Views: 418

Answers (2)

Oleg Saidov
Oleg Saidov

Reputation: 89

Use offsetHeight of an element wrapping you cell content, instead of char count to be more precise.

Upvotes: 0

user2827377
user2827377

Reputation: 1381

Set your rowHeight as normal, but also set a rowHeightGetter. Below is an example of setting row height as a function of the length of some array in our row. Another example would be using the length of some string to set row height.

<ResponsiveFixedDataTable 
  headerHeight={50}
  rowsCount={data.length}
  rowHeight={66}
  rowHeightGetter={(rowIndex) => Math.max(66, data[rowIndex][2].length * 22)}
>

Upvotes: 1

Related Questions