简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM