How can I make row-click independent of checkbox-selection of row in react-tabulator?

1.1k Views Asked by At

I wish to select a row on row click and select the checkbox on check. these should be independent of each other.

I tried making the row selectable as true in options, but want to change the "rowSelection" formatters settings as being independent

const options = {
      height: 270,
      width:  100,
      layout:"fitColumns",
      tooltips:true,
      rowSelected:true,
      autoResize:true
    };
columns= {[
            {formatter:"rowSelection", titleFormatter:"rowSelection", align:"center", headerSort:false, cellClick:function(e, cell){
                cell.getRow().toggleSelect();
                // cell._cell.setValue(true);
                console.log("CheckboxSelection......", cell)
              }, width: 20},
1

There are 1 best solutions below

0
Oli Folkerd On

If you are using the rowSelection formatter you don't need to handle the cellClick event it should toggle the selection for you.

if you are trying to stop a cellClick propagating to a row click then you should call the stopPropagation function on the event in the cellClick:

cellClick:function(e, cell){
    e.stopPropagation(); // prevent click event propagating up to row.
}