Updateing cell values on checkbox click

Posted by: dsatpute on 16 March 2023, 2:48 am EST

    • Post Options:
    • Link

    Posted 16 March 2023, 2:48 am EST - Updated 16 March 2023, 2:53 am EST

    Hi,

    As shown in attachment, I need to implement following functionality.

    When user select checkbox in Col1 then Col2 should be changed to 10. if its unchecked then it should be 0.

    Let me know how to achieve this in Angular 13 + FlexGrid.

    Regrads

  • Posted 16 March 2023, 3:05 pm EST

    Hello,

    You may handle the cellEditEnded event of FlexGrid to set the cell value of the col2 column when the editing gets ended for the corresponding cell in col1. Please refer to the code snippet and sample link below demonstrating the same:

    cellEditEnded: function (s, e) {
          var col = s.columns[e.col],
            dataItem = s.rows[e.row].dataItem;
          if (col.binding == 'col1' && dataItem['col1']) {
            s.setCellData(e.row, 'col2', 10);
          } else {
            s.setCellData(e.row, 'col2', 0);
          }
        },

    Sample link: https://stackblitz.com/edit/js-jhbh6h?file=index.js

    Regards

  • Posted 19 March 2023, 7:50 pm EST

    Thanks, It worked

Need extra support?

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

Learn More

Forum Channels