using "createdRow" to change style -- style change does not display
using "createdRow" to change style -- style change does not display
Hello again.
2 questions.
(1) I'm using createdRow to change the background color of a table row if two dates int he row are > 14 days apart. The calculation works ok, and the command to add a special class to the row works -- because I see it added in the debugger,
but the row does not change color in the table.
The modified <tr> reads
<tr class="delinquent odd">
and the class "delinquent" is defined as
.delinquent {background-color:blue;}
When I look at the Elements view
there is a strikethrough in the background-color:blue; command, suggesting to me that another css background-color is taking precedence
(see https://dl.dropboxusercontent.com/u/49189/gotlib1.tiff for screencapture)
Can you help?
(2) using the same "createdRow" function
is there a way to modify the style of a <td> cell?
Thanks
David Gotlib
This question has an accepted answers - jump to answer
Answers
Hi David,
Thanks for the details and the screenshots. You are quite correct that another rule is taking priority - specifically the one shown at the top of the CSS list in your screenshot from
table.dataTable.stripe tbody tr.odd
.There are a few options that spring to mind:
display
class from your table, padding adding others such asrow-border
if needed).selected
class and you could basically do the same. Or you could even use theselected
class.Yes, you have the
tr
element, it is passed into the callback, so you can just manipulate it as you wish using jQuery:for example.
Allan
Using '!important! solves the problem
and including the :eq jQuery in the createdRow section works nicely.
One more question:
createdRow works only when a row is created (right?)
but how do I run the same code in createdRow
on a row whose content is changed by inline-editing?
Thanks
David