Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

FilterTable to Table

Teri Ru
9 years ago Jun 28, 2012 5:40am
Jens Jansson
9 years ago Jun 28, 2012 6:35am
Teri Ru
9 years ago Jun 28, 2012 7:29am
Roger Stenman
8 years ago Jul 24, 2013 9:42am
Henri Sara
8 years ago Jul 24, 2013 9:58am
Roger Stenman
8 years ago Jul 24, 2013 10:15am
sunil patel
8 years ago Mar 09, 2014 1:04am
Peter Mezei
7 years ago Jul 01, 2014 8:45am

Hello,

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);
addComponent(exportTable);
exportTable.setVisible(false);          

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

          }
});
addComponent(btnExcelExp);

 

Dorothea Karalus
7 years ago Aug 06, 2014 1:51pm
Brijesh Rana
5 years ago Sep 01, 2016 1:25pm