ayeshas7
ayeshas7

Reputation: 93

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

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},

Upvotes: 0

Views: 1364

Answers (1)

Oli Folkerd
Oli Folkerd

Reputation: 8398

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.
}

Upvotes: 0

Related Questions