Add function in a column's className

Add function in a column's className

josivanljosivanl Posts: 11Questions: 3Answers: 1

I have a datatable that has a daughter table, where it does not always have data to display, this my daughter table is empty. I follow this example https://datatables.net/examples/server_side/row_details.html and I would like to be able to change the className of my first column so that when there is no data for a daughter table, the expansion indicator does not appear.

Here is my code that I tried to do but it did not work:

columnDefs: [
                    {
                        targets: 0,
                        className: function (td, cellData, rowData, row, col) {
                            if (row.ctes === ''){
                                return '';
                            }
                            return 'details-control';
                        }
                    }
                ],

This way the parameters (td, cellData, rowData, row, col) do not receive any information about the line, and I can not tell if my column is null or not

This discussion has been closed.