How to Hide Column in Mendix Data Grid

0
Need to Hide column when Values are empty in the columns.In the Attached screenshot 'INR' Column is empty, on the time need to hide Column automatically while opening the page.
asked
1 answers
0

The recommended approach is to check, when the page loads (page load microflow) or in the DataGrid2 datasource microflow, whether there is at least one non-empty value in the relevant column. For example, you can do a simple retrieve to check if there is any record where the INR field is not empty.


You then store the result of this check in a Boolean variable, for example HasINRValues. If at least one record has a value, this Boolean is set to true; otherwise, it is set to false.


Next, in the DataGrid2, set the Visibility of the INR column to Conditional and use this Boolean as the condition. When the Boolean is false, the column will not be shown at all. When it is true, the column will be displayed normally.


DataGrid2 does not do this automatically, because it does not dynamically hide columns based on the loaded data. That’s why this explicit check is required.


In short, creating a small control microflow on page load or in the datasource to set a Boolean, and using that Boolean for column visibility, is the cleanest and most controlled solution.


answered