All,
I have 2 tables in my app. I’m using the “Simple Table” example from Shane’s AppleScriptObjc Explored to populate data in Table1 using an Array Controller object.This table gets its data from a hard-coded list object. This works fine. In the table2, I need to fetch data from a DB before populating it. This part works well. I get the data from DB in a list format. But I can’t seem to populate the Table2 with this data. I have added 2 Array Controller objects for each table in my project. Everything is hooked up in IB correctly.
Here is the code:
aTable1:missing value
property theData : {} -- the table1 data
property aTable1Data:{"Alabama","California","New York","Nevada"}
property theArrayController : missing value
aTable2:missing value
property theData2 : {} -- the table2 data
property theArrayControllerTable2 : missing value
on populateData_(sender)
set retVal to my fetchData(myState)-- returns a list
tell current application's NSArray to set theArray1 to arrayWithArray_(retVal)
tell theArray1 to set my theData2 to sortedArrayUsingSelector_("localizedStandardCompare:")
end populateData_
on applicationWillFinishLaunching_(aNotification)
tell current application's NSArray to set theArray to arrayWithArray_(aTable1Data)
-- set our property to sorted list
tell theArray to set my theData to sortedArrayUsingSelector_("localizedStandardCompare:")
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
This doesn’t work as Table2 always gets populated with hard-coded list data instead of the fetched DB data.
What am I doing wrong here?