I'm trying to use selection eligibility on tabulator using a checkbox column, but I can't get it to work
Run the snippet below, some rows should be selectable and some not, but they all are.
var tableDiv = document.querySelector("#tableDiv");
var tableData = [
{id:1, name:"Oli Bob", age:"12", col:"red", dob:""},
{id:2, name:"Mary May", age:"1", col:"blue", dob:"14/05/1982"},
{id:3, name:"Christine Lobowski", age:"42", col:"green", dob:"22/05/1982"},
{id:4, name:"Brendon Philips", age:"125", col:"orange", dob:"01/08/1980"},
{id:5, name:"Margret Marmajuke", age:"16", col:"yellow", dob:"31/01/1999"},
];
var columnConfig = [ //Define Table Columns
//my checkbox selection column
{
title: "",
formatter: "rowSelection",
titleFormatter: "rowSelection",
hozAlign: "center",
headerSort: false,
},
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", hozAlign:"left"},
{title:"Favourite Color", field:"col"},
{title:"Date Of Birth", field:"dob", sorter:"date", hozAlign:"center"},
];
var myTable = new Tabulator(tableDiv, {
data: tableData,
columns: columnConfig,
selectableRowsCheck:function(row){
//row - row component
return row.getData().age > 18; //allow selection of rows where the age is greater than 18
}
});
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/5.5.2/css/tabulator.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/5.5.2/js/tabulator.min.js"></script>
<div id="tableDiv"></div>
Almost there... Clicking the header checkbox selects all rows regardless of the condition
Follow up question here: Selection eligibility not working with header checkbox on Tabulator

You are using version
5.5.2, in this version, the prop to disable certain row's selection is calledselectableCheck.Bumping to
5.6.1change theselectableCheckto the expectedselectableRowsCheck.To enable the selection of rows, you should enable that by passing
selectable: truefor5.5andselectableRows: truefor5.6.Based on OP's comment, these options allows you to toggle if the row is selectable by clicking it. Don't forget to enable the selection of rows in the first place, that seems to be missing in your code snippet.
Regarding removing the checkbox if the row isn't selectable, you can use a custom formatter, an example is found in this SO answer.
An other way is to use some CSS, there is a
tabulator-unselectableclass on the rows you're targeting, with some extra you candisplay: nonetheinput.5.5.2Demo usingselectableandselectableCheck5.6.1Demo usingselectableRowsandselectableRowsCheck