Sorting column headers event in datatable

Sorting column headers event in datatable

TavishiTavishi Posts: 15Questions: 4Answers: 0

I want to have an event on changing the column sort order.This can be a click event as well as keypress event. For that I found a link : https://datatables.net/examples/advanced_init/dt_events.html
In this : .on( 'order.dt', function () { eventFired( 'Order' ); } )
So can you suggest me how I can use this function to fetch the column name , index . so that I can perform further operations .

Replies

  • TavishiTavishi Posts: 15Questions: 4Answers: 0
    edited February 9

    'I am using Order.dt event for sorting of column headers, But there is one issue in this. It should ideally work only when user click or keypress on column headers but it is getting called even if user click on any table row.

    Can this be avoided?'

  • colincolin Posts: 1,218Questions: 0Answers: 229

    Hi Tavishi,

    Take a look at this live example. If you open the console, you'll see the messages. These are only being displayed when the user clicks on the table header to change the ordering.

    Hope that helps,

    Cheers,

    Colin

Sign In or Register to comment.