I have an ASS project that I’ve been working on for about two weeks. It was working well until I tried to add some sorting to my data source. I used to have two columns of data, but I just added a third and want to sort the data by this third column. When I run the app it will work fine for a couple of loops, but then it starts to get a little crazy, acts like it locks up.
Here is the code in question…
set theDataSource to data source "datasource"
delete every data row of theDataSource
make new data column at end of data columns of theDataSource with properties {name:"FileName"}
make new data column at end of data columns of theDataSource with properties {name:"FilePath"}
make new data column at end of data columns of theDataSource with properties {name:"ModDate", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
set theCount to count of items in myNames
tell kMainWindowRef
set contents of text field "date" to theDate
set contents of text field "time" to theTime
set contents of text field "count" to theCount
end tell
repeat with i from 1 to theCount
set theDataRow to make new data row at end of data rows of theDataSource
set contents of data cell "FileName" of theDataRow to item i of myNames
set contents of data cell "FilePath" of theDataRow to item i of myPaths
set contents of data cell "ModDate" of theDataRow to item i of ModDates
end repeat
set sorted of theDataSource to true
set sort column of theDataSource to data column "ModDate" of theDataSource
If I comment out the "set sorted of theDataSource to true, it goes back to working as well as it used to. The only thing I can think is that the data is being displayed in my table, then it is having to “update” the display based on the sort and causing a “display” problem.
Any thoughts on how I can correct this?
Thanks,
Dave