Vincent
Vincent

Reputation: 105

Vaadin Spreadsheet: performance problem with SpreadsheetFilterTable

I am trying integrating the Spreadsheet component of Vaadin Pro into our web app. The project is based on SpringBoot 3.2.2 and Vaadin 24.2.0. The idea is, to load out a number entries from database, and present them in a table of the Spreadsheet. I use the class SpreadsheetFilterTable to set filter to each of column of the tables after the data are written to the sheet. However, I found that time costed by refreshing the sheet after changeing filters is be proportional to the number of rows that the table contains. With about more than 2 thousands rows of data the user experience is decreased significantly, when the sheet refreshing takes over 1 minute by selecting or deselecting 1 filter.

I spent some time looking out how table filtering works. In the class Spreadsheet.class I found the following method, which is related to table filtering:

public void setRowHidden(int rowIndex, boolean hidden) {

   Sheet activeSheet = this.getActiveSheet();

   Row row = activeSheet.getRow(rowIndex);

   if (row == null) {

       row = activeSheet.createRow(rowIndex);

   }

   row.setZeroHeight(hidden);

   SpreadsheetFactory.calculateSheetSizes(this, this.getActiveSheet());

   if (this.hasSheetOverlays()) {

       this.reloadImageSizesFromPOI = true;

       this.loadOrUpdateOverlays();

   }

   this.getSpreadsheetStyleFactory().reloadActiveSheetCellStyles(); 
}

I don't understand why SpreadsheetFactory.calculateSheetSizes and this.getSpreadsheetStyleFactory().reloadActiveSheetCellStyles are called after setting each row to be hidden. If these two methods are called only once after the property zeroHeight of all rows are set, maybe it doesn't take so long after filter is modfied.

Has anyone encountered the same issue and does anyone have suggestion to address this problem?

Upvotes: 0

Views: 18

Answers (0)

Related Questions