Is there a way to get DataTables to apply stripe classes to the elements too?
Is there a way to get DataTables to apply stripe classes to the elements too?
jasonperrone
Posts: 9Questions: 0Answers: 0
The asStripeClasses feature is awesome. I dynamically create tags when creating my tables based on style choices made by the user and then I use the stripe feature to have DataTables assign those classes to the TR's when building the table, and badda boom badda bing, works perfectly.
My problem is I want to allow people to choose td styling on an alternate row basis, styling like font-size. Because the datatable td cells are not being assigned with a class, my td's are inheriting their styles from places I cannot change (long story). I think my problem would be solved if DataTables put the stripe classes not just on the tr elements but also the td elements they contain.
Any thoughts?
My problem is I want to allow people to choose td styling on an alternate row basis, styling like font-size. Because the datatable td cells are not being assigned with a class, my td's are inheriting their styles from places I cannot change (long story). I think my problem would be solved if DataTables put the stripe classes not just on the tr elements but also the td elements they contain.
Any thoughts?
This discussion has been closed.
Replies
// apply classes to TD cells too
var tdNodes = nRow.childNodes;
for (var i = 0; i < tdNodes.length; i++) {
var tdNode = tdNodes[i];
$(tdNode).removeClass( aoData._sRowStripe ).addClass( sStripe );
}
However, can't you just do:
[code]
tr.odd td { ... }
tr.event td { ... }
[/code]
in your CSS?
Allan
Allan
Thanks, sorry to waste your time.