sStripOdd/Even Init Not Working

sStripOdd/Even Init Not Working

bergbrainsbergbrains Posts: 3Questions: 0Answers: 0
edited June 2010 in General
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

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I think you are looking for asStripClasses ( http://datatables.net/usage/options#asStripClasses ) rather than sStripOdd / Even, since those parameters don't exisit. DataTables will quietly ignore them.

    Allan
  • bergbrainsbergbrains Posts: 3Questions: 0Answers: 0
    Thanks, Allan. I'll see if I can get that to work.

    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
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi 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
  • bergbrainsbergbrains Posts: 3Questions: 0Answers: 0
    Mahvelis! Works just as you'd expect. Thanks for your help clearing that up, Allan.
This discussion has been closed.