Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82603

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

$
0
0

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?


Viewing all articles
Browse latest Browse all 82603

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>