Removing the Ability to Sort a Table

Hi All,

I'm looking for a way to remove the sort functionality from a specific table. The table only has one row (I'm using it like a progress bar) and I want to disable the ability for users to click the headers and sort the table. Is there any code I can use to achieve this?

Thank you in advance!

Worked like a charm! Thanks, Kelson!

Hi Matt, 

Here is some JavaScript I wrote really quick that will change the anchor HTML elements into spans so they will no longer be clickable. Be sure to change the "VIEWKEY" with the one that is loading the table. You can find your view key here:
http://d2z9u6n32o8z20.cloudfront.net/support_assets/devdocs22.png


Knack = Knack || {};
Knack.fn = Knack.fn || {};

Knack.fn.disableHeaders = function(viewKey){
Knack.$(`#${viewKey} table thead th a`).each((i, header)=>{
Knack.$(header).replaceWith(`<span>${Knack.$(header).html()}</span>`)
})
}

//Replace 'VIEWKEY' with your view key.
$(document).on('knack-view-render.view_VIEWKEY', function(event, view, data) {
Knack.fn.disableHeaders(view.key)
});


If you have any further questions feel free to reach out.

Best, 

Kelson
kelson@ksensetech.com
https://www.ksensetech.com/knack/