'How to exclude columns from row selection in tabulator 5.2

I have a table with selectable rows. I want to exclude clicks on the "SAS" column from changing the row selection.

var tabledata = [
  {name:"Oli Bob", location:"United Kingdom", gender:"male", col:"red", dob:"14/04/1984"},
  {name:"Jamie Newhart", location:"India", gender:"male", col:"green", dob:"14/05/1985"},
  {name:"Gemma Jane", location:"China", gender:"female", col:"red", dob:"22/05/1982" },
  {name:"James Newman", location:"Japan", gender:"male", col:"red", dob:"22/03/1998"},
];

var table = new Tabulator("#example-table", {
    data:tabledata,
    selectable: true,
    columns:[
      {title:"Row Num", formatter: "rownum"},
      {title:"Name", field:"name", width:200}, 
      {title:"SAS", formatter: "tickCross"} // exclude clicks on this column from changing the selection
],
});

Kind regards, simon



Solution 1:[1]

I used a cellClick event on your "SAS" column to handle your need.

Working Demo: https://codesandbox.io/s/exclude-cols-from-row-selection-ikxth5?file=/src/index.js

Not sure if there is any other proper way to achieve that as my solution is kind of a trick. But hope it helps!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SM1312