react-bootstrap-table2 icon indicating copy to clipboard operation
react-bootstrap-table2 copied to clipboard

When I render a new set of data, the formatter doesn't apply to all of the fields

Open ashcorah opened this issue 7 years ago • 2 comments

I am rendering XYZ set of data that all go through the formatter: (cell, row) => option.

However, I have a selection option to get a different set of data. When I set the state of my components data to ABC data when the option is clicked, it's then passed to BootstrapTable but not every field/row go through the formatter option. Some do, some don't.

image

Is there any way to force the tables data to go through the formatter every time?

ashcorah avatar Feb 19 '19 16:02 ashcorah

@AshCorah would you please use this example to create a simple and minimal example for me to reproduce this issue? (be careful to the version of react-bootstrap-table2 in above link)

This issue might be a bug or your formatter is not pure:

check document, there's something important

Attention: Don't use any state data or any external data in formatter function, please pass them via formatExtraData. In addition, please make formatter function as pure function as possible as you can.

due to performance concerns, so that we hope developer can write a pure formatter so that we can decide if re-render a cell base on props only.

anyway, if ok, I want to check your XYZ and ABC dataset, thanks.

AllenFang avatar Feb 20 '19 15:02 AllenFang

Don't worry, I have resolved my issue. I wasn't using a pure component. I've resolved the problem :) Thanks for you help anyway!

ashcorah avatar Feb 21 '19 09:02 ashcorah