Change the text color for entire row (like disabling it) when render button is clicked

Change the text color for entire row (like disabling it) when render button is clicked

DanaDana Posts: 28Questions: 15Answers: 1

I'm trying to change the text color of entire row like it's disabled and also disable the buttons for that row when a button from that row is clicked.

         table = $("#dt").DataTable({
                data: tableContent,
                columns: [
                { data: "Col1", title: "Col1" },
                { data: "Col2", title: "Col2" }
                ],
                "columnDefs": [
                {
                    "targets": 1,
                    "render": function (data, type, full, meta) {
                        // If it is rendering the cell contents
                        if (type === 'display') {
                                if(data == 0)
                                    return '<div style="text-align:center"><button type="button" class="btn btn-danger" onClick="Test('+ meta.row + ')">Click!</button></div>';
                            }
                        return (isNaN(data)) ? -1 : +data;
                    }
                }]
            });


function Test(row) {
     //change color here and disable button from that row
}

but when the Test function is called row value is undefined. What am I doing wrong?

This discussion has been closed.