Hello everyone,
Hiding a column dynamically is possible in DataGrid2.
Example: You have 4 columns in your DataGrid2 and the requirement is to hide the 4th column when the data is sorted by first two columns and make it visible again when the data is sorted by 3rd column.
If this is what you mean by dynamically hiding the column, then please read below:
I will be creating a video tutorial soon on this topic and will share the link here in future.
Hope this helps.
Resurrecting an old thread a bit but with the later versions of Datagrid 2 this can now be done on a per-column basis with expressions and works very well
Hi Nisha,
I do not know, whether the existing answers apply to your question. Yes, you can “manually” hide columns using the “eye” button. In my understanding, “dynamically” means that you can control the hiding of the column using data. That is exactly what I am trying to do and why I found this post.
As far as I can see, that cannot be done. You can dynamically set the class for a cell, but this would at best empty the column, not hide it. When you have only one or two columns that needs to be hidden dynamically, you can place multiple datagrids in your container (with and without said columns). Depending on your data, you could make only one datagrid visible at any given point in time. For more hideable columns this would become very ugly very fast.
Correct me if I am wrong, but the only other potential option I can see, would be to somehow “press” the eye button programmatically, but I do not know, whether this can be done, actually.
Hi Nisha,
have a look at section 2.4 in the datagrid2 documentation https://docs.mendix.com/appstore/modules/data-grid-2/#24-hiding