Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
Is this the right way that i can parseInt inside if else statement for Datatable

I am new to JS BS Datatables, is this the right way to parseInt for if else statement?

$(document).ready(function() {
    $('#myTable').DataTable({
        "order": [],
        "columnDefs": [{
            "targets": 'nosort',
            "orderable": false,
        }],
        
        
        "fnRowCallback": function(nRow, aData) {
            if (parseInt(aData[7].innerHTML,10) <= 30) {
                $('td', nRow).css('background-color', 'Red');
            } else if (aData[2] >= "30" && aData[2] < "50") {
                $('td', nRow).css('background-color', 'Green');
            }
        }
    });

});

for example as you can see from my code i try to convert the row aData[7] to intiger and put into statement.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  "fnRowCallback": function(nRow, aData) {
                if (parseInt(aData[7], 10) <= 30) {
                    $('td', nRow).css('background-color', 'Red');
                } else if (parseInt(aData[7], 10) >= 31 && parseInt(aData[7], 10) <= 50) {
                    $('td', nRow).css('background-color', 'orange');
                }
            } else if (parseInt(aData[7], 10) >= 31 && parseInt(aData[7], 10) <= 50) {
                $('td', nRow).css('background-color', 'orange');
            }

Hi everyone sorry for the question, I already solve it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!