mimic Posts: 43Questions: 0Answers: 0
edited November 2009 in Bug reports
I have a problem with aaSorting. In 1.5.4 (I do not know about before) I have to click twice on an arrow to reverse a presorted column. This is happening even on example page: http://datatables.net/examples/basic_init/table_sorting.html - try to reverse sort of "CSS grade" column. You will have to click twice.
This discussion has been closed.
Thanks for bringing this to my attention. The bug is actually in the example, rather than in DataTables itself. There is some new functionality in 1.5.4 which makes the sorting control that you the developer has much more flexible, but it also means that we might need to provide a little more information in some cases - such as this one!
By default DataTables will use the ordering "asc", "desc" for sorting, but we want to switch this around for the example here. Therefore, asSorting must be used for this specific column to over rule DataTables' default. Have a look at the example, and come back with any questions you might have.
Otherwise there is no use for second value in aaSorting, it could be simply something like:
what would mean sort by 4th column initially. And it would sort it according to the first element of aoColumns' asSorting (or default).
It is possible, but we come around back in a loop to the reason why you first opened this discussion - DataTables would then move from the sorting direction that you have given it to the asSorting direction, which could leave it in the same state... Perhaps one option might be use the second array element in aaSorting as an integer which would specific the asSorting element which should be used for initial sorting - but that might get a bit complicated for newcomers...
It could be a little while... :-). I'll see how this feature goes down in the 1.5.x series, and if it needs changing fairly quickly due to confusion. I have been thinking about making 1.6.x a fairly rapid release (relative to the several months for 1.5.x), but haven't had a chance to move on that yet...