Subtotals on certain fieldson Grid

Posted by: riya.katawate16 on 21 June 2022, 7:27 am EST

  • Posted 21 June 2022, 7:27 am EST

    Hi Team,

    I want to show subtotal only for certain fields on wijmo-Grid

    , Currently its showing subtotal for all fields.

    How can I achieve this. Please help.

    Thank you.

  • Posted 22 June 2022, 12:39 am EST

    Hello,

    You may use the formatItem event of the FlexGrid and check if the instance of the row is a GroupRow(subTotal row) then remove the cell value from its innerHTML. You may refer to the code snippet below for reference:

    
      onFormatItem(s, e) {
        if (
          e.panel === s.cells &&
          s.rows[e.row] instanceof wjcGrid.GroupRow &&
          s.columns[e.col].binding === 'amount' &&
          s.rows[e.row].dataItem.name == 'Germany'
        ) {
          e.cell.innerHTML = '';
        }
      }
    
    

    You can also refer to the sample link below demonstrating how to remove the subtotal from the group name Germany, you can use a similar approach to implement it as per your requirement.

    Sample link: https://stackblitz.com/edit/angular-xd3add?file=src%2Fapp%2Fapp.component.ts

    Regards

Need extra support?

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

Learn More

Forum Channels