Sort Array Controller or Table

I have an array controller bound to a table view (cell based) with arrangedObjects and Model Key Path is self. It is a single column, no headers. When data is loaded into the array controller I want it to be sorted alphabetically or when displayed in the table view sort it then. Table is read only so nothing ever gets added. I thought there may be a way to accomplish this without code but haven’t found it yet. Anyone know how to sort without headers showing?

You need to set the sort descriptors of the array controller (setSortDescriptors:). But given nothing gets added, it would be easier to just sort the data yourself.

I can sort the data then pass it to array controller. Thanks!

   
set my arrayControllerData to sortAList_(theList)
 
on sortAList_(theList)
        set anArray to current application's NSArray's arrayWithArray_(theList)
        return anArray's sortedArrayUsingSelector_("compare:")
end sortAList_

FWIW, if you’re running a relatively recent version of the OS you’re likely to run into trouble if you keep using the underscore syntax from 10.8 – there’s a good chance Xcode will start ignoring your action handlers.

It also suggests you’re not using an external editor to write your code, which tends to make life more difficult.