Hi,
DataGrid2 does not currently expose an API or action to programmatically show/hide columns like the built-in column selector does. However, you can achieve this using visibility conditions.
Recommended approach
Create a helper object or page variable (Boolean attributes per column, or an enum).
Add custom controls (buttons, toggles, checkboxes).
Update the Boolean values via microflows or nanoflows.
Use those values in the Visibility property of each DataGrid2 column.
This gives you full control over when a column should be visible and works consistently across multiple DataGrid2s.
Example
Boolean ShowPrice
Button → sets ShowPrice = true/false
Column “Price” → Visibility condition = ShowPrice
Notes
This is the most flexible and maintainable solution
Built-in column selector behavior cannot be triggered externally
Works well for custom UI/UX requirements
This pattern is commonly used in production apps and scales well when designed cleanly.
As a workaround,
Create a non-persistent helper entity and add boolean attributes such as ColumnA, ColumnB, ColumnC for each DataGrid2 column. When the page opens, create an instance of this entity and initialize all boolean values to true.
Wrap the DataGrid2 inside a DataView that uses this non-persistent object. This allows the grid and the column settings to share the same page state. Add a “Select Columns” button above the grid that opens a popup.
In the popup, display only these boolean attributes as checkboxes so the user can choose which columns should be visible. Add an “Apply” button on the popup. When clicked, the same non-persistent object is updated and refreshed, and the popup is closed.
As a result, the user selects the desired columns in the popup, clicks Apply, and the DataGrid2 is re-rendered based on the updated non-persistent settings object.