How Can I Disable Column Sorting?

How Can I Disable Column Sorting?

zgoforthzgoforth Posts: 493Questions: 98Answers: 2

Link to test case: https://jsfiddle.net/BeerusDev/mznL52p8/151/

Hello, I am trying to disable sorting because for some reason whenever I try it on any column, my row grouping gets all whacky and breaks up. I found a bunch of solutions related to this on Stack Overflow using CSS like so:

.dataTable > thead > tr > th[class*="sort"]:before,
.dataTable > thead > tr > th[class*="sort"]:after {
    content: "" !important;
}

and this method halfway works, it makes them no longer visible, but the sorting still happens if you click on the column <thead>

This question has an accepted answers - jump to answer

Answers

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    UPDATE: My search terms were somewhat off on this site, but after some changing of wordage, I was able to find the answer: After initialization of the DataTable, set

    "ordering": false,
    

    right before the column definitions and it works like a charm!

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    Answer ✓

    Use columns.orderable to turn off the users ability to order the columns. You need to leave sorting enabled for rowGroup to work.

    Kevin

  • zgoforthzgoforth Posts: 493Questions: 98Answers: 2

    I was just editing my previous comment, because yes it was messing with my rowGroup, but I added ordering: false, to all my column definitions and it works like a charm, thanks Kevin!

This discussion has been closed.