How to add new column or remove column dynamically from browse table

Hi,

How to add new Column or remove a column from the browser table ?

1 Like

Hi,
You can programmatically manage table columns in the screen controller.
The following code shows how to collapse a column.

public class DemoBrowse extends AbstractLookup {
    @Inject
    private GroupTable<Demo> demoTable;

    public void testMethod() {
        List<Table.Column> columns = demoTable.getColumns();
        Table.Column target = columns.get(0);
        if (target != null){
            target.setCollapsed(true);
        }
    }
}

You can remove or add columns in a similar way. You can also create generated columns.
See the documentation for more information.