Sorting Table Columns

hey gang…Tables are a hot topic these days. Probably every day is a good day to ask a Table question.

My question is on sorting Tables. I’m working with the example code found in the Terminology Reference for scripting a column sort. But I have to ask…isn’t sorting a table by clicking on a column header a common thing? Shouldn’t that be built into interface builder?

So I looked, and lo and behold, there are a set of three “sort” attributes in a Table Column’s attributes. My problem is that I have no idea what to do with these. They look mighty promising, and I would think it’d be far easier to just type a few things into widgets in IB than it would be to always script the column sorting.

I did notice, too, that putting something in “Sort Key” seems to enable the little triangle that tells you a column is being sorted ascending or descending. The funny thing is that it doesn’t seem to matter what is in the “Sort Key”, just that anything is in the “Sort Key” to enable that triangle. My guess is that you’d put something like “alphabetical” in there, but again I’m kinda like a country bumpkin on his first visit to the modern marvels of the big city…I’m just randomly pushing buttons and seeing what happens.

And of course I’ve googled a few key terms, but not much turned up. Quite a few Cocoa examples, but those are pretty much lost on me.

Any insight would be greatly appreicated.

Thanks!!

/Developer/Examples/AppleScript Studio/Table Sort/

Thanks Jobu, helpful post as always, but that doesn’t really answer my question.

While it was helpful to look at the sample app (which for some reason I never noticed before), most of that code is already in the Terminology Reference that I was, well, referencing. My question was more about sorting tables via Interface Builder, not through scripts. Like I said, I saw that there was a “Sort Key” attribute on each Table Column, and wanted to know how to use it. The Table Sort demo app doesn’t make use of it, and relies solely on scripting to sort Tables.

I’m OK with that, it just seems that sorting by clicking a column would be a common task that could be rolled into an IB option…and it looks like you can do that, but everything I found by Googling “Interface Builder Sort Key” and the like lead to articles on Cocoa, not AppleScript Studio. So, I’m just wondering how use the “Sort Key”, if I can, in my AS Studio Tables.