Render pivot table using server side data

Posted by: atif on 10 February 2021, 6:36 pm EST

  • Posted 10 February 2021, 6:36 pm EST

    I am trying to create a pivot table that consists of large data that exceeds millions of records. To optimise the performance on client side, I want to perform the Pivot calculation on the backend using Snowflake or any other tool and then use spread js to render this pre calculated data.

    Is there any direct or indirect approach to achieve server side pivoting using SpreadJS?
  • Marked as Answer

    Replied 11 February 2021, 11:48 pm EST

    Hi Atif,

    Since the SpreadJS is purely based on client-side applications this feature not supported with SPreadJS. What you could do is after the calculation is done you may use add method to add the pivot table on the sheet. Please refer to the following code snippet and let us know if you face any issues.


    let spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 2 });
    let sheet1 = spread.getSheet(0);
    let sheet2 = spread.getSheet(1);
    sheet1.setRowCount(250);
    let table = sheet.tables.add('table1', 0, 0, 200, 200);
    sheet1.setArray(0, 0, pivotSales);
    let pivotTable = sheet2.pivotTables.add("PivotTable", "table1", 0, 0, GC.Spread.Pivot.PivotTableLayoutType.outline, GC.Spread.Pivot.PivotTableThemes.medium2);


    PivotTable Demo: https://www.grapecity.com/spreadjs/demos/features/pivot-table/overview/purejs

    Regards
    Avinash
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels