Custom Summary

Posted by: rodrigo.oliveira on 12 May 2021, 10:23 am EST

    • Post Options:
    • Link

    Posted 12 May 2021, 10:23 am EST - Updated 3 October 2022, 1:45 pm EST

    According to the attached image, I need to calculate the total that is in red, making an account with the values that are in green and blue. Red = ((Blue / Green * 100) - 100).

    How to proceed in vue.js?

  • Posted 16 May 2021, 11:13 am EST

    Hi,

    To achieve the required functionality you may use the calculatedFields feature of the collectionView. Please refer to the following code snippet and the sample demonstrating the same:

    flexgrid.collectionView.calculatedFields = {
            calculated: (item) => item.sales - item.expenses,
          };
    

    https://codesandbox.io/s/wijmo-vue-forked-oz3lt?file=/src/components/HelloWorld.vue

    API reference:

    https://www.grapecity.com/wijmo/api/classes/wijmo.collectionview.html#calculatedfields

    Regards

  • Posted 18 May 2021, 9:28 am EST

    Good morning, unfortunately this is not my case. I need to calculate the final result, in the footer. As per the picture.

  • Posted 19 May 2021, 2:20 pm EST

    To achieve the required functionality you may handle initialized event as well as cellEditEnded event and inside handler you may get columnFooter cell’s data using getCellData,pPerform calculation and then assign the calculated value to the columnFooter cell using setCellData.

    Please refer to the following code snippet and the attached sample:

    initializedGrid(flex){
            flex.columnFooters.rows.push(new wjcGrid.GroupRow()); 
            flex.bottomLeftCells.setCellData(0,0,'S'); 
            // initial data calculation
            this.calculate(flex);
        },
    
        calculate(flex){
            let totalDownloads = flex.columnFooters.getCellData(0, 'downloads');
           let totalSales = flex.columnFooters.getCellData(0, 'sales');
           let customTotalExpenses = ((totalSales / totalDownloads * 100) - 100)
           flex.columnFooters.setCellData(0,'expenses',customTotalExpenses);
        }
    

    Grid_Aggregation_Belowthedata_Vue.zip

  • Posted 4 June 2021, 10:37 am EST

    Good Morning. It worked, thank you very much.

Need extra support?

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

Learn More

Forum Channels