FilterTable to Table

Is there a way to convert a FilteringTable to Table? (aside from creating a new Table and using set and getContainerDataSource())

I am using the add-ons FilteringTable and TableExport and am having errors when creating the table right before export.

final Container filterTableContainer = <filterForFilterTable()>;
		FilterTable filterTable = new FilterTable();
		Panel 	panelTab = new Panel();
		exportButton.addListener(new ClickListener() {
			private static final long serialVersionUID = 1L;
			private ExcelExport excelExport;
			private Table table;
			public void buttonClick(final ClickEvent event) {
				table = new Table();
				excelExport = new ExcelExport(table);

error i get

com.vaadin.event.ListenerMethod$MethodException: Invocation of method buttonClick in com.example.vaadinfirst.VaadinfirstApplication$1 failed.
	at com.vaadin.event.ListenerMethod.receiveEvent(
	at com.vaadin.event.EventRouter.fireEvent(
	at com.vaadin.ui.AbstractComponent.fireEvent(
	at com.vaadin.ui.Button.fireClick(
	at com.vaadin.ui.Button.changeVariables(
Caused by: java.lang.NullPointerException
	at com.vaadin.terminal.StreamResource.<init>(
	at com.vaadin.addon.tableexport.TemporaryFileDownloadResource.<init>(
	at com.vaadin.addon.tableexport.TableExport.sendConvertedFileToUser(
	at com.vaadin.addon.tableexport.ExcelExport.sendConverted(
	at com.vaadin.addon.tableexport.TableExport.export(

I’m trying to avoid using too many Tables as my container has too many rows.

I am new to vaadin, and appreciate all the help I could get.


You can’t really convert a FilterTable into a Table as the latter doesn’t extend the former. What you do, by creating a new table and moving the container, is the closest thing I also come up with to use the two add-ons together. It
be that you lose some filtering in that process, but it just have to be tested out to be sure. The filtering in stored in the container so I think you are safe.

What you do should work because you are now only working with only one add-on inside the clicklistener. What I looked at the code, my guess would be that it has some issues with writing content into the temp file that will be sent to the user. If you are familiar with debugging code, that would be your best bet to figure out what goes wrong. Put a break point in the beginning in ExcelExport.sendConverted(), and debug all the way to the exception. It might be that the error has happend earlier, if the workbook.write(fileOut) doesn’t write anything to the file.

You can always also make an own implementation of TableExport, that you would use instead of ExcelExport.

Thanks Jens. debugging starts…
(or as you said, will have to implement my own TableExport. hello poi…) :slight_smile:


Is there any other solution to this problem, or did you solve it, Teri? Exporting to Excel and Filtering a table are both pretty common tasks and it would seem people are commonly using the two together.

I’m in the same situation Teri was in, where I want to use TableExport together with FilteringTable. I get the same error and, additionaly, when debugging I get:

IOException while loading persisted sessions: writing aborted; org.apache.poi.hssf.usermodel.HSSFCellStyle writing aborted; org.apache.poi.hssf.usermodel.HSSFCellStyle

In case there is no good solution to this, how would I go about making “my own implementation” of TableExport?

The second exception is mostly harmless - it comes from your server (Tomcat?) serializing sessions over server restarts and some Apache POI classes that are kept in session not being compatible with that, and just leads to the sessions being re-initialized. I’m not sure if those POI classes really need to be kept in the session, though, as I haven’t looked into the internals of TableExport.

You can disable that functionality in Tomcat by uncommenting the “Manager” line in the default context.xml or the server.

Ah, like I thought then. Feels good to let that particular nuisance slip aside from my mind for now!
Thank you Henri!

However, I’m still stuck with using the two addons together.
I’ve tried converting FilterTable to Table using the container from FilterTable (by using setContainerDataSource(filterTableContainer)), but it doesn’t seem to work right off the bat.

Hi All,

Kindly share the solutation if any one of you already have it. I am also facing same problem how to convert FilterTable to Table.


I know this is an old topic, but people (just like myself) might look for a solution to this problem.

The reason for Teri’s nullpointer exception was that the TableExport addon (while exporting) was trying to get the actual vaadin UI through its Table parameter, which was null because he just created that temp Table to store the FilterTable’s data. The solution is to add the temp Table to the UI before trying to export. (You can set the Table to not be visible.)

exportTable = new Table(null, filterTable);

btnExcelExp = new Button(null, new ClickListener() {
          private static final long serialVersionUID = 1L;
          public void buttonClick(ClickEvent event) {
              ExcelExport excelExport = new ExcelExport(exportTable);
              excelExport.setReportTitle("Demo Report");


FilterTable is actually supported by the TableExport addon!!/thread/579717/5213742

“…There are two classes you should use in TableExport, CustomTableHolder and CustomTableExportableColumnGenerator, if you have a CustomTable…”

we can export FilterTable in excel. below code working for me…

final Button excelExportButton = new Button(“Export to Excel”);
final CustomTableHolder holder = new CustomTableHolder(table);

    excelExportButton.addListener(new ClickListener() {
        private ExcelExport excelExport;

        public void buttonClick(final ClickEvent event) {
            excelExport = new ExcelExport(holder, "Test Name", "Test Name", "LabTest122.xls");
            excelExport.setReportTitle("Test Name");