Sortable column headers without links?

Sortable column headers without links?

ShatyUTShatyUT Posts: 6Questions: 0Answers: 0
edited August 2011 in General
A sortable column header is rendered with 2 ways to sort. If you click on the header text it is a link which will refresh the page passing in querystring parameters telling the table how to sort a column. If you click the header outside of the header text, the sort is done client side. Is there a way to disable the link being rendered in a sortable column? I want to be able to sort and client-side sorting is perfect for me. I do not want my users to be able to click the link and refresh the page accidentally which may cause them to lose form data.

I know I can use jQuery to intercept the click event and stop it but just wondering if there is a way to disable it in the DataTables configuration. I couldn't find anything in the docs or any previous posts asking the same question.

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    The reason you couldn't find any mention of this in the docs is because there is no built in way of doing what you are looking for :-) (and :-( ). I'm afraid you would need to go the route of applying some custom event handlers to the TH elements in the table header.

    Allan
This discussion has been closed.