Enable/disable column sorting event

Enable/disable column sorting event

bootstrap-fortunabootstrap-fortuna Posts: 2Questions: 0Answers: 0

How can i disable and enable sorting in datatable after generating the datatable. Suppose when select any chekbox of any row depend my datatable sorting will disable and after dselect it will again enable.

I have implement this code $('.dataTables_scrollHead thead th').off('click.DT'); it disable the sorting event. But I can not again bind the click event. Please help how can i solve the situation.

Replies

  • allanallan Posts: 61,786Questions: 1Answers: 10,114 Site admin

    You've got the right way to remove the event (its a bit ugly, but it works!).

    To add an event listener you can use order.listener() to attach DataTables sorting listener to a column again.

    Allan

  • bootstrap-fortunabootstrap-fortuna Posts: 2Questions: 0Answers: 0
    edited March 2017

    Thanx for reply. I have use this but not working. my sorting is disabled but not enabled. Please help me for any other solutions

  • allanallan Posts: 61,786Questions: 1Answers: 10,114 Site admin

    You'd need to give me a link to a JSFiddle showing the issue so I can offer any help.

    Allan

This discussion has been closed.