I have a BE that returns an Array of objects (columns) in React. The objects are structured like this {headerName: 'string', field: 'string', visible: boolean}. The visible parameter doesn't actually do anything as the column will always be visible. I know in AgGrid the Column Object has a visible parameter which if changed shows or hides the column. How can I make AgGrid use the visible parameter the backend gives me? Am I using the wrong strategy here? How would you do it? As far as changing the object returned by the backend and AgGrid settings.
CodePudding user response:
To hide/show a column in AG Grid, you have to set the hide property on the column: 
Since your server is returning visibility, I would suggest either of the two approaches:
- On the client side - Add a function to modify the data returned from the server, such that
visibilityis renamed tohide
- On the server side - the response object for the data should have the
hideproperty
CodePudding user response:
use useMemo and recreate the columnDefs when needed:
