Stumped on a sorting problem.
Stumped on a sorting problem.
25000+ tables created now using DataTables no problems. Great java script. I finally ran into a strange problem
with sorting. So here it is:
Just a simple initialization. Has worked fine on everything else.
[code]
$(document).ready(function() {
oTable = $('.datatable').dataTable({
"bJQueryUI": true,
});
});
[/code]
The problem I'm having is trying to sort columns with graphic images or rather strange values in them.
So If I have x9 rows that look like this. So 10-19.gif it works perfectly. So with 9 different .gif images it works.
Now heres the strange thing, as soon as I add the #10 .gif image the sorting stops working totally. It just
randomly sorts the images when I click the sort tab. I've tried using all sorts of different values for the .gif
images nothing seems to work. So I'm guessing that its the strange type values.
But I'm baffled why it works perfectly with 9 values. Any help would be much appreciated.
[code]
1
2
3
[/code]
etc etc.
with sorting. So here it is:
Just a simple initialization. Has worked fine on everything else.
[code]
$(document).ready(function() {
oTable = $('.datatable').dataTable({
"bJQueryUI": true,
});
});
[/code]
The problem I'm having is trying to sort columns with graphic images or rather strange values in them.
So If I have x9 rows that look like this. So 10-19.gif it works perfectly. So with 9 different .gif images it works.
Now heres the strange thing, as soon as I add the #10 .gif image the sorting stops working totally. It just
randomly sorts the images when I click the sort tab. I've tried using all sorts of different values for the .gif
images nothing seems to work. So I'm guessing that its the strange type values.
But I'm baffled why it works perfectly with 9 values. Any help would be much appreciated.
[code]
1
2
3
[/code]
etc etc.
This discussion has been closed.
Replies
You need a different naming convention on the images. You can see this same thing happening when you have a date column and you use human readable friendly dates: 9/27/2010 2:36 PM (is bad) whereas 2010-09-07 02:36:00 works perfectly.
I agree, there should be some sort of support for this.
01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
are static. It's really simple just 10 different .gif images.
01, 02, 03, 04, 05, 06, 07, 08, 09 those all sort and work fine. As soon as I add the 10 the whole sort order
becomes random.
It's really strange. I guess I need to make a custom sorting script, which I was trying to avoid as it's just 10 files.
But turning off the auto HTML parsing on the columns worked.
[code]
"aoColumnDefs": [
{ "sType": "string", "aTargets": [ 1,2 ] }
]
[/code]
But my theory on how this works is, datatables looks at as a
NULL value. By default the HTML parser is turned on and it ignores anything between a
< > for the purposes of sorting.