I have a table view that is populated from a SQLite db. The table has 3 columns: Name, Next Run, Row ID.
After creating a new record, I need to select that row in the table view.
I am looking for a solution to one of the following two issues.
The first, which would be my preferred solution, is a way to search each data cell (data cell “rowid”) for a number and select that row. I would assume this would be in some kind of a repeat loop?
OR
The second fix for my problems could be as simple as just selecting the last row in a table view.
But this doesn’t work:
set selected row of table view "svList" of scroll view "svList" of window "workhorse" to last row
repeat with i from 1 to count of data rows of theDataSource
set thisRow to data row i of theDataSource
set theContents to contents of data cell "rowid" of thisRow
if thecontents = yourSpecifiedNumber then
--Your code here
end if
end repeat
Ok, one last option using Obj-C and Call Method. This will select the row and scroll the table
so the row is in view.
AppleScript:
set aTable to table view 1 of scroll view 1 of window 1
set chosenRow to 8
call method "selectingRow:aTable:" of class "Table" with parameters {chosenRow, aTable}
set theDataSource to data source of table view "svList" of scroll view "svList" of window "workhorse" -- set the data source
set theRows to count of data rows of theDataSource --count the rows in the data source
set selected row of table view "svList" of scroll view "svList" of window "workhorse" to theRows -- select the last row based on above number
Thanks for the help Craig!
Browser: Safari 525.20.1
Operating System: Mac OS X (10.5)