Search code examples
vaadinvaadin7

Calling refreshCells() with list of 3000+ cells makes vaading spreadsheet non responsive


I am using vaadin spreadsheet addon version 1.1.6. In my project sheets in workbook will have minimum 40 rows and 60 columns. When user navigates between sheets I need to update cellstyles of around 3000+ cells. After applying styles I need to refresh the cells to see the changes in UI. I am using Spreadsheet.refreshCells() to refresh cells. Once I make this call UI hangs and I get a message in browser that cache.js is not responding. I would like to know if anyone facing this issue and found the resolution?


Solution

  • Not sure if it a proper solution but I have found a workaround for this problem. I think refreshCells() API in Spreadsheet can't handle large number of cells. Instead of refreshCells() I used Spreadsheet.getSpreadsheetStyleFactory().cellStyleUpdated(). Find sample code below

    for(int i=0; i< row.getPhysicalNumberOfCells();i++)
    {
       Cell cell = row.getCell(i);
       CellStyle cellStyle = cell.getCellStyle();
       /*
       Apply Styles here
       */
    
       spreadsheet.getSpreadsheetStyleFactory().cellStyleUpdated(cell, true);
    }