Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:21:24+00:00 2026-06-04T18:21:24+00:00

I need to create a jQuery datatable, in which some rows might have gray

  • 0

I need to create a jQuery datatable, in which some rows might have gray background color – meaning that they are disactivated. A row can have gray background only if the column ‘status’ of the corresponding MySQL table is equal to 0.

Look at the below code. Column ’10’ is hidden. It contains status value. If it is 0, then the row should have different background color. But this does not work. No error message. Any ideas?

$(document).ready(function(){
              $('#newspaper-b').dataTable({
              "sPaginationType":"full_numbers",
              "aaSorting":[[4, "asc"]],
              "aoColumns": [null,null,null,null,null,null,null,null,null,null,
                            {"bSearchable": true, "bVisible": false},null,null],
              "bJQueryUI":true,
              'fnRowCallback': function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                    if(aData[10]=="0"){
                        nRow.className = "disactivatedRow";
                    }
                    return nRow;
                }
              });

CSS

.disactivatedRow td { 
    background-color:#ffbba9 !important;
    color: #e6e6fa;
}
#newspaper-b {
    border-collapse: collapse;
    border-color: #B7DDF2;
    border-style: solid;
    border-width: 1px;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 11px;
    margin: 0;
    text-align: left;
    width: 480px;
}
#newspaper-b th {
    background: none repeat scroll 0 0 #EBF4FB;
    border-color: lightgray;
    font-size: 11px;
    font-weight: bold;
    padding: 15px 10px 10px;
}
#newspaper-b tbody tr td {
    background: none repeat scroll 0 0 #FFFFFF;
}
#newspaper-b td {
    border-top: 1px dashed #FFFFFF;
    color: #000000;
    padding: 10px;
}
#newspaper-b tbody tr:hover td {
    background: none repeat scroll 0 0 #FFCF8B;
    color: #000000;
}
#newspaper-b tbody tr.selected td {
    background: none repeat scroll 0 0 #FFCF8B;
    color: #000000;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:21:26+00:00Added an answer on June 4, 2026 at 6:21 pm

    Row doesn’t have content hence background, td should be colored instead:

    .disactivatedRow td { 
        background-color:#ffbba9 !important;
        color: #e6e6fa;
    }
    

    If still doesn’t solve I’d suggest you to console.log(aData[10]) outside of your if. For console.log to work use Chrome/Firefox, find console output via F12 and see what aData[10] contains, maybe you need aData[9] (programmers use to count from zero ;).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help to create jquery script :) I have some of link
I need to create a DIV that has some content (some of which is
I'm having a bit of a jQuery problem. Basically I have some functions that
I am learning JQuery. I have a need to create a custom control. This
I need to create a jQuery ui datepicker that will let users choose a
Basically I need to create a textarea that is character limited, but will have
Possible Duplicate: Jquery:: Ajax powered progress bar? I need to create some kind of
I need to dynamically create the Jquery UI widget. My idea is to have
How create a link_to_remote in a jQuery script where url need a parameter that
I need to create an analytics solution for a client. They have a large

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.