Is it possible to disable sorting for one column header?
Is it possible to disable sorting for one column header?
I've probably spent way longer than I needed to, so I figured I'd try here for some assistance. I have a sortable table in place (courtesy of DataTables), but I was asked to remove sorting from one column header. I've tried using boolean and on-click code, but no cigar. Here is my test page - http://www.psta.net/testing/tabletest.php
There are two tasks I could use a hand with:
1) Remove the sorting option from "Item Requested."
2) In the search box, make the clear/reset 'x' permanently visible (not just when you enter text).
Any help would be greatly appreciated!!
This question has accepted answers - jump to:
Answers
http://www.datatables.net/forums/discussion/5782/disable-sort-on-particular-column
Thank you, tangerine!
I tried the above, and it "appears" how they would like it to be. In other words, there is no arrow to indicate the sorting option. However, if you click on 'Item Requested', it still sorts by that column. Thoughts?
I adjusted my code to this, according to the documentation.
Thank you again, and have a great day!
Yes - please link to a test case showing the issue. With your exact code, it disabled sorting on the third column, as you can see here: http://live.datatables.net/furofuf/1/edit .
Allan
Hi Allan, thanks for chiming in! Here's my test page: http://www.psta.net/testing/tabletest.php
Why are you including tablesorter.js?!
I'm not sure what you mean. They want it to be initially sorted by the first column. That portion is working though.
If you're going to use DataTables, don't use tablesorter. They are not compatible.
Thank you again! I'll try that!
Perfect! I just have to figure out the issue with the clear button for the search field, and I'm golden. ^_^ I read that it's an HTML 5 function, so it's only visible on certain browser versions. It's a minor issue though. You made my day!
That's entirely up to the browser's implantation of the
<input type="search">
element. You would need to replace the element with a custom input control if you wanted control over it.Allan
Gotcha! I'll try to get it sorted soon. Thank you, Allan ^_^