Help /w JS - Determine if Table Sorted and Sort if not


In my app I'm rending a table that Knack will not give me to ability to determine which column is sorted by default. Of course the column I wanted to be sorted, is not. I get get JS to determine if the column is sorted but then I can't get it to actually sort it.

Code using to determine if sorted (I'm new to JS so if this is bad code, feel free to question my intelligence)


$(document).on('knack-view-render.view_179', function(event,page) {

if ($(".field_178.sorted-asc").length < 1) {

alert("Not Sorted");


else {




The alerts are there just to test that it was working and code to sort it would go in there place.

Any thoughts?