sStripOdd/Even Init Not Working
sStripOdd/Even Init Not Working
bergbrains
Posts: 3Questions: 0Answers: 0
I've added entries for sStripOdd and sStripEven to my initialization data for dataTables, but it's not going into effect. I'm still seeing 'odd' and 'even' instead of the classes for which I configure it.
Is this a known bug?
Eric
Is this a known bug?
Eric
This discussion has been closed.
Replies
Allan
Have a look at the section entitled "Stiping" on this page: http://datatables.net/styling/custom_classes. it seems to indicate that those parameters do exist. They are also referenced in the code, and the default values that you see in the code are in fact those that are applied by default. Did I misinterpret this in the docs?
Thanks again.
Eric
Ah ha - yes I see what has happened. All of the classes that DataTables applies can be customised - including the 'odd' and 'even' classes. This is done before table initilaisation with something like:
[code]
$.fn.dataTableExt.oStdClasses.sStripOdd = "table_odd";
$('#example').dataTable();
[/code]
Where as the other method is to use the asStripClasses initialisation parameter:
[code]
$('#example').dataTable( {
"asStripClasses": [ 'strip1', 'strip2', 'strip3' ]
} );
[/code]
This provides a bit more flexibility (since you can provide an array of any length).
Two different ways of achieving the same thing basically :-)
Allan