Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


$.fn.dataTableExt.afnSortData does not work with jQuery 1.9.x #161

CILLERt opened this Issue · 1 comment

2 participants


Since jQuery 1.9 the $.fn.dataTableExt.afnSortData results in random search results with strings. Numbers do work in some cases but in most cases also don't.

found this topic:

Which solved my issue for now. Lets see who has to fix it, But maybe change the documentation about afnSortData to make it clearer for other users.


Agreed - I think the DataTables documentation certainly needs to be updated, regardless of any changes in jQuery.

@DataTables DataTables closed this issue from a commit
@DataTables Fix #161: DOM sorting plug-ins updated
- Cope with the change in jQuery 1.9 for element ordering. From the
  DataTables thread on this topic ( 14316 ):

So a bit of further investigation into this - I've used these two test

No DataTables:

The new DataTables version shows that jQuery 1.9 is now always trying to
order the nodes by document order, not but the order that they are found
in the source array. Additionally removed nodes are appended to the
results, themselves in reserve order, but that's just the way the Sizzle
node ordering works when items are not in the document (try sorting
numbers and you get the same result).

Given the suggestion in the release notes that the move is to have nodes
always treated in document order, I don't think this is a bug, so not
filing one. It is a bit frustrating that the nodes are iterated in a
different order from the source array, but it is expected from their
documentation and comments. So this is simply something we'll need to
work around.

To that end, I've updated the examples and taken the unusual step of
updating the examples on this site outside the normal release cycle. The
examples in the 1.9.4 current release of DataTables can't change of
course, but the updated examples will be in 1.10 when it is released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.