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 4256654
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:23:03+00:00 2026-05-21T05:23:03+00:00

I have a DataTables table. Here’s a simplified version of what I have as

  • 0

I have a DataTables table. Here’s a simplified version of what I have as a result:

$('#dt_list').html( '<table cellpadding="0" cellspacing="0" border="1" class="content" id="test"></table>' );

$('#test').dataTable( {
    "bAutoWidth": true
    "aaData": [ 'val1', 'val2', 'val3' ],
    "aoColumns": [ 'col1', 'col2', 'col3' ],

});

...stuff here..

<div id='dt_list'></div>

The JavaScript arrays are generated by a Python script based on values extracted from a MySQL database (it would be otherwise irrelevant, but I just want to make sure people reading this know that I’m dynamically generating the content arrays outside of JavaScript).

As I’ve said, the data being displayed on this table is the result of a MySQL query that is then processed by Python and output into the JavaScript in the page generated by Python.

I have logic in my Python code to determine not only what value goes into a cell, but also whether the cell requires any highlighting (via the cell’s background color). My question here is, how can I arbitrarily change the color on certain DataTable cells?

Since most of my logic is in Python, I don’t really need anything very fancy or elegant evaluations in the JavaScript, I just need some sort of way in JavaScript to manipulate a cell’s CSS property or in some other way indicate a different coloring.

I’ve looked into fnRender and it seems my best hope. However, my two issues at this point are (a) I can’t find a way to manipulate the color from within an fnRender function (it seems to be more targeted to manipulating the content itself) and (b) I’m unsure how I’d be able to have fnRender know the result of the Python operation to determine whether special coloring is needed.

Is there something I’m missing? Or maybe I just need to re-think how I am approaching this? Ideally I’d like a solution to this that doesn’t involve reworking the way I’m doing this, but I’ll change the way I generate the data or pass it if I must. I’m modifying some existing code and would rather not mess with the existing design, but take the shortest, easiest path to converting its table listing output to DataTables, and part of that is generating certain cells as having a modified color.

  • 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-05-21T05:23:04+00:00Added an answer on May 21, 2026 at 5:23 am

    Your “fnRender” callback can return cell contents wrapped in a marker <span> or <div> (or whatever). You can then use the fnDrawCallback function to find those and tag the parent <td> element with a class.

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

Sidebar

Related Questions

I have 2 datatables in a dataset. One table has a list called CostTypes.
I have created this query to fetch some result from database. Here is my
Here is HTML markup of 2 rows from my huge table (which generated by
I have to send html for a table to an html-to-pdf converter script. My
I just have a simple ASP Table seen here: <asp:Table ID=tblCategories runat=server CssClass=oneColTable padded-table
You have a pseudo-table class and a pseudo-row class. The row is somewhat generic
I have to use a certain table styling on only show.html.haml pages of my
Woah, I have this serious problem with jquery datatables plugin. I have a table
I'm using jQuery DataTables . This is my markup: <div class='wrapper'> <form> <table> <tr>
I have a DataTable which I want to save to a SQLite Database Table.

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.