Datatables is overriding cell background color

Datatables is overriding cell background color

minifiredragonminifiredragon Posts: 55Questions: 11Answers: 2

Is there a reason why datatables is overriding a cell color? I used:

(Please note, I have tried both createdRow and rowCallback)

rowCallback: function( row, data, dataIndex)
 {
     $(row).css("background-color", "Orange");
     $(row).addClass('red');
 },

But it seems that datatables wants to use it's own color (from Firefox debugger):

background-color: rgb(255, 255, 255);
datatables.min.css:109
Best Match table.dataTable tr td

The row has the class added:

rgb(255, 165, 0);

element
Best Match this.style
orange

semantic.min.css:11
Matched .ui.ui.ui.ui.table tr.red:not(.marked)
rgb(255, 225, 223)

I did not post any examples because it is a basic table, and I have made no modifications to the datatable or CSS, and the css files and js files were downloaded from Datatables yesterday.

Answers

  • minifiredragonminifiredragon Posts: 55Questions: 11Answers: 2

    I should note I removed the styling with this:

    $j('table.dataTable tr td').css({ 'background-color' : 'initial', 'opacity' : '' });

    But I am curious if I am missing something in the intial setup of the table.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    If you're using BS4 this thread might help - it was asked a couple of days ago!

    If not, it's working as expected here. Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.

    Cheers,

    Colin

  • minifiredragonminifiredragon Posts: 55Questions: 11Answers: 2

    I am using Fomantic UI v2.8. Which I believe is the problem. When I added the

    $j('table.dataTable tr td').css({ 'background-color' : 'initial', 'opacity' : '' });

    It brought back the odd/even cell shading as well.

    Fomantic UI is the currently maintained version of the Semantic UI, and I noticed the version listed on the site is very old. Anyway Datatables can update to using fomantic ui 2.8?

    Also, I cannot look at your example (or make my own) as it is giving a 404 error. And if I just go straight to https://live.datatables.net/, it says the server is offline.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    My example is loading for me : http://live.datatables.net/howikafe/1/edit - note it's "http", not "https". We're comment back on the 2.8 version later,

    Colin

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Anyway Datatables can update to using fomantic ui 2.8?

    Yes :). I had a discussion with one of the Formantic UI developers last week and I do indeed plan to update what we use to Formantic rather than Semantic UI.

    Allan

  • minifiredragonminifiredragon Posts: 55Questions: 11Answers: 2

    @colin Firefox keeps forcing me to the https, but Chrome let me see that page. I do not have a live place where I have fomantic ui loaded that I can link to an example, but I am pretty sure that it is fomantic and datables not getting along. I have previous forum discussions regarding issues with fomantic/semantic ui and datables (as well as the fix to get around it). I will chaulk this one up to that as well.

    @allan That is good to hear! Looking forward to giving it a test run. My web stuff is mainly running fomantic, and I would like to see if I can remove some of the hacks I deployed to get it working together in some cases.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    Here is a little demo with Formantic UI: http://live.datatables.net/gataxado/1/edit along with your row callback function from above. It appears to be orange and red okay for me.

    Regarding the https access to the live site - I do need to set that up! I wonder if you have ssl everywhere or something installed in Firefox.

    Allan

Sign In or Register to comment.