reordering columns breaks keyboard based sorting

reordering columns breaks keyboard based sorting

jonbrockjonbrock Posts: 1Questions: 1Answers: 0
edited March 2017 in Free community support

Demo: https://datatables.net/extensions/colreorder/examples/initialisation/simple.html

Instructions: First, confirm that keyboard based sorting is working. Tab to a column header and hit enter, it should sort ascending, hit enter again, it sorts descending. Now, reorder any column by dragging it to a new position. Tab back to a column header and hit enter. The column sorts either ascending or descending (whatever it was last sorted by). Hit enter again, the sort direction does not change.

Any workaround for this?

Edited to add: tested this in Chrome, Firefox, and Edge and they all have the same problem. No errors in javascript console.

Answers

  • peterdrinnanpeterdrinnan Posts: 4Questions: 0Answers: 0

    Same issue for me. It appears in my case the aoDrawCallback event is being fired twice in the datatables library which is resulting in the following order sorting method being called twice.

    _fnCallbackFire( oSettings, null, 'order', [oSettings, aSort, sortedColumns] );

    It isn't that the sorting isn't working, but rather it is being called twice which nullifies the desired result.

  • allanallan Posts: 62,296Questions: 1Answers: 10,215 Site admin

    Agreed - it looks like an event listener is being doubled up. I'll post a fix shortly.

    Thanks for letting me know about this.

    Allan

  • allanallan Posts: 62,296Questions: 1Answers: 10,215 Site admin

    Fix committed here. The nightly version will carry this change in the next 5 minutes or so.

    Allan

This discussion has been closed.