Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ag-grid cell level checkbox select

I want to show all rows, all columns with checkbox as I want only true/false value. But I want to access single cell value i.e. each of the checkbox can be checked/unchecked. see image below.

enter image description here

As per my knowledge when I tick checkbox, all checkboxes of row get selected. So, can I check/uncheck single box?

like image 318
ghetal Avatar asked Nov 26 '25 00:11

ghetal


1 Answers

      {
      headerName: 'Operator',
      checkboxSelection: false,
      headerCheckboxSelection: false,
      filter: false,
      sortable: false,
      field: 'operator',
      cellRenderer: function(params) {
        let operatorValue = params.value;
        const input = document.createElement('input');
        input.type = 'checkbox';
        if (operatorValue) {
            input.checked = true;
            params.data.operator = true;
        } else {
            input.checked = false;
            params.data.operator = false;
        }
        input.addEventListener('click', function (event) {
          input.checked != input.checked;
          params.data.operator  = input.checked;
        });
        return input;
    }
    }

Hope this will help for presentation as well as setting the value.

like image 106
aswininayak Avatar answered Nov 27 '25 12:11

aswininayak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!