Could you elaborate on the use case that you are trying to implement here
If you are needing to display different columns for different user roles I would suggest that you actually display completely different grids to each user role. An element hidden by styling is simply not displayed but is still on the page and could pose security risks.
Let me know if the above makes sense or is relevant to the case that you are trying to implement.
I think we can't do this in DataGrid(not sure), instead you can use list view and apply conditional visibility to required columns.
I know it is possible, but it gives headache on maintenance/handover and if you add an excel/csv export to that grid those hidden columns are exported too.
If complexity is added, i prefer it to be on standard mendix logic:
- Create snippets of the datagrid, with the different colum-arrangements
- Add an enumeration (could be done with a helper object on a dataview) with the different options to contidionally displays the right snippet.
- create a selector with the enumerated attribute to choose the value of the enumeration (and the right snippet will be shown)