TR Styles Showing as "even odd" instead of just "even" or "odd"
TR Styles Showing as "even odd" instead of just "even" or "odd"
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]
(Ive 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.
Whats 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]
Im using version 1.6.2
Thanks in advance!
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]
(Ive 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.
Whats 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]
Im using version 1.6.2
Thanks in advance!
This discussion has been closed.
Replies
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
Allan