Search code examples
tabulator

Is there a way to toggle the row selectable option on/off without recreating the tabulator


title pretty much says it, I have users that have different roles they can choose from and I need to toggle the row selection functionality on/off depending on the role they choose, is this possible or do you have to recreate the tabulator to change this value?


Solution

  • This option is not toggleable once the table has been instantiated, but you could use a Selection Eligibility function to determine if the row should currently be selectable:

    var table = new Tabulator("#example-table", {
        selectableCheck:function(row){
            //row - row component
            return row.getData().age > 18; //allow selection of rows where the age is greater than 18
        },
    });
    

    You could tweak the above example to look at a global boolean that you toggle to determine if the table is selectable