The ExcelAction button on my table isn’t displaying the values of the column I added using the
myTable.addGenerateColumn() method.
How can I get those values to display without creating my own action?
The ExcelAction button on my table isn’t displaying the values of the column I added using the
myTable.addGenerateColumn() method.
How can I get those values to display without creating my own action?
Hi,
You can read about using generated columns along with excel action in the documentation.
Regards,
Gleb
Thanks. I was having difficulty with the code there, but altered it a bit and had good results.
ordersTable.addGeneratedColumn("product", new Table.PrintableColumnGenerator<Order, String>() {
@Override
public Component generateCell(Order /*entity*/ order) {
Label label = componentsFactory.createComponent(Label.NAME);
Product product = order.getProduct();
label.setValue(product.getName() + ", " + product.getCost());
return label;
}
@Override
public String getValue(Order /*entity*/ order) {
Product product = order.getProduct();
return product.getName() + ", " + product.getCost();
}
});