TR Styles Showing as "even odd" instead of just "even" or "odd"

TR Styles Showing as "even odd" instead of just "even" or "odd"

elite-robelite-rob Posts: 26Questions: 0Answers: 0
edited May 2010 in General
Hello All,

First off, this script is amazing... truly amazing!

Secondly, after banging my head against the keyboard for the past hour, I decided I needed to post in this forum because I must be doing something wrong.

When I first click a column header to SORT the columns, I end up with styles that look like this:
[code]




[/code]
(I’ve omitted the contents of each TR to highlight the problem)

I expect the classes to be “even” then “odd” and then repeat. But, for whatever reason I am getting these classes “even odd”.

The problem is that this messes up all the row alternating BG colors because the ”tr.odd td.sorting_1” style never kicks in because the ‘even odd’ is throwing it off.

What’s strange is that if I click the column again to sort it once more, the problem corrects itself.
At this point the HTML looks like this:
[code]




[/code]
And, at this point, the alternating row BG colors works because the style ”tr.odd td.sorting_1” loads correctly.

Any idea what is going on that the classes are skewed on the first sort?
(Note: This problem happens if data is sorted on load or if data is not sorted on load, but then a column header is clicked)

This is the code I am loading:
[code]
$('#datatable').dataTable( {
"aoColumns": [
{ "sType": "html" },
null,
{ "sSortDataType": "dom-checkbox" },
{ "bSortable": false }
],
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"aaSorting": [ ] // Prevents initial sorting
} );
[/code]
I’m using version 1.6.2

Thanks in advance!

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Hi elite-rob,

    Actually you've just hit a bug in 1.6.x... DataTables currently assumes (incorrectly) that there isn't row stripe classes on the table when it initialises, and as an optimisation it doesn't try to strip them automatically. Sometimes you can get away with it depending on the length of data, paging etc, but sometimes you get the two classes together :-(

    This has been addressed in 1.7, and if you fancy alpha testing it for me, drop me a note http://datatabes.net/contact .

    Regards,
    Allan
  • geetmenongeetmenon Posts: 2Questions: 0Answers: 0
    I am using version 1.7.5 of dataTables. I face the same issue. Has this not been fixed yet?
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Yes it should be - can you give us a link to a page showing the error please?

    Allan
This discussion has been closed.