.draw() API is not resetting ordering to default

.draw() API is not resetting ordering to default

nipun_tulsyannipun_tulsyan Posts: 5Questions: 1Answers: 0

I have added default sorting on column 7 during initialisation of datatable. Now if change the sorting to column 2 and redraw the datatable sorting still remains on column 2 instead of defaulting to column 7. I thought redrawing the datable with true parameter will reset sorting to default.

Answers

  • kthorngrenkthorngren Posts: 21,324Questions: 26Answers: 4,949
    edited August 2021

    The draw() docs state this for the true parameter:

    the ordering and search will be recalculated and the rows redrawn in their new positions. The paging will be reset back to the first page.

    It doesn't state that ordering will be reset back to default . You can use the order() API to change the order before you use draw() to reset the order to the desired order.

    Kevin

Sign In or Register to comment.