Deselect all checkbox in multirow by manipulate CollectionView data

Posted by: maricar.m.clariza on 11 January 2022, 7:14 pm EST

  • Posted 11 January 2022, 7:14 pm EST

    Hi :)
    Just need assistance..


    ^I created a function for 'Cancel All' <- once the user hit this button all checkbox must have value false to uncheck it.. I created a script for this trigger (code below)

    this.returnedSamplesData.filter = (item) => { return item.scope = false };

    however, it seems like its not working properly . coz once i trigger the cancell button all records will display none.
  • Replied 12 January 2022, 10:56 pm EST

    Hello,

    To de-select all the selected rows on click of a button you may iterate over each row and set the isSelected property to false and refresh the collectionView to update the checkboxes state. Please refer to the code snippet below demonstrating the same:

    .html file code:
     <button class="btn btn-primary" (click)="removeSelectionAll(flex,$event)">
    Cancel all
    </button>



    .ts file code
      removeSelectionAll(grid, e) {
    grid.rows.forEach((row) => {
    row.isSelected = false;
    });
    grid.collectionView.refresh();
    }


    Regards
  • Replied 14 January 2022, 1:38 am EST

    this isnt working :( im using multirow btw
  • Replied 16 January 2022, 11:21 pm EST

    Hello,

    Please refer to the sample link below demonstrating the implementation of the shared code in the multiRow control:

    https://stackblitz.com/edit/angular-2pmyj2?file=src%2Fapp%2Fapp.component.html

    Regards
Need extra support?

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

Learn More

Forum Channels