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

  • SEARCH
  • Home
  • 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 8087367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:45:11+00:00 2026-06-05T18:45:11+00:00

i have a really nice style for my tables. { sorry links no more

  • 0

i have a really nice style for my tables.

{ sorry links no more working }

I had to add sClass so that new rows (added by fnAddData) get the right classes.

Unfortunately that ruins my layout, becouse these classes are also added to my table-header cells!

{ sorry links no more working }

How can I configure sClass to apply only for TBODY cells?

To clarify:

  var rolesTable = $('#roles').dataTable({
      "aoColumns": [
        { "mDataProp": "id", "sClass": "avo-lime-h avo-heading-white" },
        { "mDataProp": "name", "sClass": "avo-light" },
        { "mDataProp": "module", "sClass": "avo-light" },
        { "mDataProp": "description", "sClass": "avo-light" },
        { "mDataProp": null, "bSearchable": false, "bSortable": false, 
          "sDefaultContent": '<button type="button" name="add" class="btn"><i class="icon-plus icon-white"></i></button>' }, 
      ],
  }); // end od dataTable

This way when i call

rolesTable.fnAddData( { 
    "id": 10, 
    "name": "testname", 
    "module": "testmodule", 
    "description": "testdescription" 
} );

then the added row looks like this:

<tr>
    <td class="avo-lime-h avo-heading-white">10</td>
    <td class="avo-light">testname</td>
    <td class="avo-light">testmodule</td>
    <td class="avo-light">testdescription</td>
    <td></td>
</tr>

AND that is perfectly OK

** the problem is ** that this setting also adds these classes to:

<thead>
    <tr> (...) </tr>
</thead>

table head cells… which I do not want

  • 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-05T18:45:12+00:00Added an answer on June 5, 2026 at 6:45 pm

    Solution to my problem was: useing fnRowCallback instead of sClass to set classes to new rows.

      var rolesTable = $('#roles').dataTable({
          "aoColumns": [
            { "mDataProp": "id" },
            { "mDataProp": "name" },
            { "mDataProp": "module" },
            { "mDataProp": "description" },
            { "mDataProp": null, "bSearchable": false, "bSortable": false, 
              "sDefaultContent": '<button type="button" name="add" class="btn btn-round"><i class="icon-plus icon-white"></i></button>' }, 
          ],
          "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
              $('td:eq(0)', nRow).addClass( "avo-lime-h avo-heading-white" );
              $('td:eq(1),td:eq(2),td:eq(3)', nRow).addClass( "avo-light" );
            }
      }); // end od dataTable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a SQL Query that isn't really nice. The SQL Query has
I see a lot of these apps like Pulse that have really nice UIs
I have some really nice Python code to do what I need to do.
Im new to iPhone development and I have really taken this to me. I
I'm using Filemaker Pro 12 Advanced. I have a few tables but have really
I'm a new poster in stackoverflow. The community seems really nice so I'll go
Earlier versions of IDEA had their own skin and looked really nice. But fresh
I have just installed PMD to analyze my Java project. Really nice tool, highly
I'm new to Ajax, and Im just loving it. Really nice. but i stucked
We have a really old legacy code base that uses globals like they're going

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.