Ordering only when click on icon

Ordering only when click on icon

tpaztpaz Posts: 1Questions: 1Answers: 0

Hi guys,

When I click anywhere on table header (th), the ordering function is called.

How can I do to ordering function be called only if i click on order icon?

Thanks

Answers

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    You'd need to use the order.listener() method to attach the event listener to a custom icon element. The problem is that the default DataTables sort icon is displayed by a CSS background image, so you can't specifically target only that with an event listener.

    Allan

This discussion has been closed.