Hi everyone,

I have a DefaultDataTable with a FilterToolbar similar to the one in the
phonebook example.
I'd like to add a link for exporting the current filtered data table to a
CSV file.
This csv file should contain the table headers and the table data.

My main problem right now is extracting the current data from the DataTable:
Is there any way to get the current displayed data from the table if I have
a reference to it? like table.getColumns.... something?
or do I have to manually call iterator(...) of the dataprovider to get this
data again from the database?

Suppose I already have a getDataAsCSV method that converts the data to a CSV
format (say a string or char[]/ byte[]),
What would be the best practice for creating a link that lets you download
this data?

thanks,
Sam




FilterForm form = new FilterForm("filter-form", dataProvider);
// create the data table
IColumn[] columns = createColumns();
table = new DefaultDataTable("datatable", Arrays.asList(columns),
dataProvider, numOfEntriesPerPage);
table.addTopToolbar(new FilterToolbar(table, form, dataProvider));
form.add(table);

Reply via email to