How do I style table cells (by column)?
How do I style table cells (by column)?
I need to style columns, specifically I'm trying to replace my existing rule:
[code]
table#my-table td.column-2 { text-align: center; }
[/code]
Since is being generated for me by the plugin, I can't figure out how to target second column cells.
My current solution is to wrap every cell content into [code][/code] but there got to be better way.
[code]
table#my-table td.column-2 { text-align: center; }
[/code]
Since is being generated for me by the plugin, I can't figure out how to target second column cells.
My current solution is to wrap every cell content into [code][/code] but there got to be better way.
This discussion has been closed.
Replies
[code]
$('#example').dataTable( {
"aoColumnDefs": [
{ "sClass": "column-2", "aTargets": [ 1 ] }
]
} );
[/code]
That will add the class "column-2" to the TD elements in the second column (i.e. index 1).
Regards,
Allan
Allan