Issue with multiple columns being marked as sorted when ordered column index is greater >= 10
Issue with multiple columns being marked as sorted when ordered column index is greater >= 10
Fiddle showing the issue
https://jsfiddle.net/k2sL41r7/11/
Description of problem:
Whenever the ordered column index is greater than or equal to 10, every column index that matches orderedColumnIndex.indexOf(currentCellIndex) != -1
is being shown as sorted on v2.0
Upon. debugging, the problem seems to be with this block of code in the header renderer
var p = h.indexOf(u.toArray().join(","));
if (-1 !== p) {
var f = s.order();
t.addClass(f.includes("asc") ? o.isAsc : "" + f.includes("desc") ? o.isDesc : "")
}
Looks like this code is leading to false positives.
Any help here would be great.
Thanks,
Rahul
This question has an accepted answers - jump to answer
Answers
Hi Rahul,
Excellent point. This is the unminified code in question.
I think what I'll do is change it to add a comma at the end of the string for
orderColumns
and also with the joined indexes. I'll try that on the unit tests tomorrow when I'm a little more awakeAllan
Thanks Allan for the quick reply.
One more thing I have noticed is that, during sort, the processing event is being called with false immediately upon sort instead of waiting for the redraw to happen. This is especially evident for data fetched via an ajax call.
My guess is around this piece of code - https://github.com/DataTables/DataTablesSrc/blob/5f976cf412efc60c3c3ef521f95c80b51b7ddbf6/js/core/core.sort.js#L62
is this expected? Do we have some way to get around this.
Hmmm, that is a mistake as well. It works for client-side processing, but not when server-side processing, where it needs to wait for the Ajax request to complete.
Allan
Do you have this in your plan to fix? Will be planning our migration to v2.0 accordingly.
Thanks!
I do yes, I just didn't get a chance to implement it yesterday. I will hopefully do so today, possibly tomorrow. It will be part of a 2.0.3 release which I expect to drop next week.
Allan
Great. Appreciate the prompt response.
I've committed the fix and it will be in the nightly builds soon.
I've also committed a fix for the issue with the processing indicator on click to sort.
Thanks for letting me know about these issues!
Regards,
Allan
Thanks Allan. Any tentative timelines for 2.0.3 to be out?
If not tomorrow, then Friday
Allan
Can confirm that both the issues have been fixed with 2.0.3. Thanks!