'How to customize datatables row?

How can I customize the row of my jquery datatables? I wanted to put a color to the row if it meets the condition isEvent == 1. I followed this code from datatables community thread/example but the == is not working.

  searchResultsTable = $('#searchResultsTable').DataTable({
        bFilter: false,
        bLengthChange: false,
        searching: false,
        orderable: true,
        autoWidth: true,
       
        columns: [
            { data: null, render: 'department', title: 'Department', orderable: false, className: 'dt-center' },
            { data: null, render: 'employeeName', title: 'Employee Name', orderable: false, className: 'dt-center' },
            { data: null, render: 'recordDate', title: 'Date', orderable: false },
            { data: null, render: 'timeIn', title: 'Time In', orderable: false, className: 'dt-center' },
            { data: null, render: 'timeOut', title: 'Time Out', orderable: false, className: 'dt-center' },
            { data: null, render: 'day', title: 'Day', orderable: false, className: 'dt-center' },
            { data: null, render: 'eventTime', title: 'OT-UT-Errand', width: '50px',orderable: false, className: 'dt-center' },
            { data: null, render: 'eventName', title: 'Event', orderable: false, className: 'dt-center' },
            { data: null, render: 'total', title: 'No. of Hours Worked', orderable: false, className: 'dt-center' },
             { data: null, render: 'isEvent', title: 'isEvent?', orderable: false,visible:true, className: 'dt-center' }
           

        ],
        createdRow: function (row, data, index) {
            if (data[9]==1) {

                /*   $(row).addClass('blue');   //add class to row*/
                $('td', row).eq(2).css('font-weight', 'bold');
                $(row).css('background-color', 'yellow');   //add class to row
            }
            //add style to cell in third column
        }
    });

I already tried data[9] > 0 ,data[9] != 0 ,data[9] === 1 but when I use the data[9] = 1 it applies to all the rows, and I had it consol.log(data[9]) it returns all 1. But on my rendered table and actual data object i have multiple 0 and 1 also tried set the column's visible:true option still not working.



Solution 1:[1]

Just accessed data directly. Like data._isEvent

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Phillip Abello