Table columns add/remove programatically


Is there anyway to setup a table in the following way:
The Datasource has many many columns and the user wants to be able to choose which columns are visible.
I only see one possibility but this is rather difficult:
I design the table with ALL available columns (it is not so ok because there is 100+ fields) and then and only then the user can switch of the columns which is not needed.

I would like to prefer the opposite situation, when the user can switch on the needed columns from all the available columns.

Can it be done?

Best Regards


probably this will work by defining a view on the fly programmatically like here: Creating Views - CUBA Platform. Developer’s Manual and then dynamically add / remove columns from the table programmatically. Additionally you would need a UI component to activate / deactivate the columns (perhaps something like the “Add Search Condition” from the Filter component).

Probably this is doable, but requires a non-trivial amount of work I would say.

Back then we had a discussion about it already: Adding entity attributes to table at runtime - CUBA.Platform - but I think it never went anywhere directly in the framework. But actually doing it as an application component does not seem to be that crazy to do.



I’ll look into it.


Hello @dobi.sandor!

Perhaps mechanism of presentations that Table, GroupTable and TreeTable components support is more suitable for you. It allows users to manage table settings.You can choose to display only the columns you need and save the presentation, if necessary.


1 Like