In Jquery Datatable, I am trying to add a class named "control" in specific columns but it seems not working. I do not see any errors.
I am selecting columns by using class name (all) and then trying to add another class "control". Please see the code below,
public static CreateTableView(tableId: string) {
let dataTable = $(tableId).DataTable({
deferRender: true,
scrollY: '200px',
scrollX: false,
scrollCollapse: true,
searching: false,
paging: false,
info: false,
columns: [
{ title: "Name", data: "Name" className: "all" },
{ title: "Age", data: "Age" },
{ title: "Serial Number", data: "Serial" },
{ title: "Description", data: "Descritption", className: "all" },
{ title: "Errors", data: "Notes", className: "all" }
],
responsive: {
details: {
type: 'none',
target: '.btn-link',
display: GetDetailsDialogDisplay(tableId),
renderer: $.fn.dataTable.Responsive.renderer.tableAll({
tableClass: 'table'
})
}
},
order: [1, 'asc'],
select: {
style: 'single',
selector: 'td .btn-link',
className: 'selected bg-selected-row'
}
});
$(tableId).off('click', '.btn-link').on('click', '.btn-link', function () {
dataTable.columns('.all').to$().addClass('control');
});
return dataTable;
};
Any suggestion / direction will be greatly appreciated.