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

rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

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) != -1is 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

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    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 awake :)

    Allan

  • rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

    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.

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    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

  • rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

    Do you have this in your plan to fix? Will be planning our migration to v2.0 accordingly.

    Thanks!

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    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

  • rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

    Great. Appreciate the prompt response.

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin
    Answer ✓

    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

  • rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

    Thanks Allan. Any tentative timelines for 2.0.3 to be out?

  • allanallan Posts: 63,434Questions: 1Answers: 10,458 Site admin

    If not tomorrow, then Friday :)

    Allan

  • rahul.katikinenirahul.katikineni Posts: 6Questions: 1Answers: 0

    Can confirm that both the issues have been fixed with 2.0.3. Thanks!

Sign In or Register to comment.