Want to use Excel Action to export data from a table with some columns set visible="false". But the default behavior only exports those columns show in the UI. So customize the action should do the trick, but I can’t find a method to get all columns including invisible columns, any idea?
Already tried with table.getColumns() it returns the same result as table.getNotCollapsedColumns():
@UiController("forum_Customer.browse")
@UiDescriptor("customer-browse.xml")
@LookupComponent("customersTable")
@LoadDataBeforeShow
public class CustomerBrowse extends StandardLookup<Customer> {
@Inject
private GroupTable<Customer> customersTable;
@Subscribe("customersTable.excel")
public void onCustomersTableExcel(Action.ActionPerformedEvent event) {
List<Table.Column> notCollapsedColumns = customersTable.getNotCollapsedColumns();
// return the same result as above line
List<Table.Column<Customer>> columns = customersTable.getColumns();
}
}
Invisible columns are not loaded from the descriptor, so Table does not contain them.
I can suggest you use a collapsed attribute on columns. Collapsed columns are not fully hidden from the user and can be restored in the Table “settings”:
If it suits your requirements, you can use this approach: