Exclude some rows from selection

Exclude some rows from selection

typhontyphon Posts: 25Questions: 7Answers: 0

Hello,

is it possible to exclude rows from selection if there is a "special" class attribute? Maybe also hide the checkbox for these rows?

Thanks and BR

Answers

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948
    edited July 2018

    Assuming you are using the Select Extension I would recommend using the columns.createdRow in the column with the Select Checkbox.

    The Checkbox example uses className: 'select-checkbox. Instead of that you can use createdRow to add the class, something like this: $(td).addClass('select-checkbox');. Then if the row data meets your criteria you can use $(td).removeClass('select-checkbox'); to remove the class and the checkbox won't appear.

    You will also need to use the selector of .select-checkbox when enabling select in your Datatables init code.

    Kevin

This discussion has been closed.