Developer Guide to AdapTable React
Summary
- Will contain a collection of various How-To Guides and Pitfalls for React Integration:
- Initialy it shows how to ppass component state to the
AdaptableOptionsparameter
Component State in Adaptable Options
The Adaptable Options object, once passed to the Adaptable instance at creation, is evaluated only once.
Caution
- This means that any changes made to Adaptable Options after this point will not be recognized
- Nor will they be reflected in the AdapTable instance
If you need to have dynamic options that can change based on the component state, you should not directly change the AdaptableOptions object.
Instead, you should define functions within the AdaptableOptions object that reference the latest values of the component state.
These functions will be evaluated at runtime, ensuring that the most recent state values are used.
Passing Component State in AdaptableOptions
- This example shows how to correctly pass component state in the
AdaptableOptionsparameter - We create a reference (
useRef()) to the up-to-date custom menu item and uses it in theAdaptableOptionsobject. - The custom menu item:
- displays the current value of the
componentState - updates the
componentStatewhen clicked
- displays the current value of the