Table Exporters
The TableExporter
interface is designed to download the Table
or DataGrid
content.
The TableExporter
interface has two standard implementations: ExcelExporter class and JsonExporter class.
An instance of TableExporter
is passed to the setTableExporter()
method of ExportAction.
Custom Table Exporter
You can define a custom implementation of the TableExporter
interface for exporting your format.
An example of declaring a custom table exporter:
@Component("ui_CustomExporter")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class CustomExporter implements TableExporter {
@Override
public void exportTable(Downloader downloader, Table<Object> table, ExportMode exportMode) {
//your custom logic
}
@Override
public void exportDataGrid(Downloader downloader, DataGrid<Object> dataGrid, ExportMode exportMode) {
//your custom logic
}
@Override
public String getCaption() {
return "custom";
}
@Override
public void addColumnValueProvider(String columnId, Function<ColumnValueContext, Object> columnValueProvider) {
//your custom logic
}
@Override
public void removeColumnValueProvider(String columnId) {
//your custom logic
}
@Nullable
@Override
public Function<ColumnValueContext, Object> getColumnValueProvider(String columnId) {
//your custom logic
return null;
}
}
ExcelExporter
Use the ExcelExporter
class to export the Table
or DataGrid
content into Excel format.
ExcelExporter
is used in the standard ExcelExportAction action.
JsonExporter
Use the JsonExporter
class to export the Table
or DataGrid
content into JSON format.
JsonExporter
is used in the standard JsonExportAction action.
Was this page helpful?
Thank you for your feedback