I’m trying to build a small app that works similar to Apple’s Address Book. I have two tables, one for Category the other for Items. I’m trying to store the datasource of the Items in the datasource for the Categories. This way when the user switches to a different Category I can pull out the Items data and put it into the Items table.
I can delete the data in the Items table, but cannot get it back out of the Category data.
Why doesn’t this work?
-- Set up theDataSource so that the rest will be simpler
set theDataSource to data source of table view "Category" of scroll view "Category" of theObject
-- Here we will add the data columns to the data source of the Category table view
tell theDataSource
make new data column at the end of the data columns with properties {name:"Category"}
end tell
-- Set up theItemData so that the rest will be simpler
set theItemData to data source of table view "Item" of scroll view "Item" of theObject
-- Here we will add the data columns to the data source of the Items table view
tell theItemData
make new data column at the end of the data columns with properties {name:"Item"}
end tell
-- play around here
-- put data into the tables
set newData to make new data row at the end of the data rows of theDataSource
set contents of data cell "Category" of newData to "test"
set newItemData to make new data row at the end of the data rows of theItemData
set contents of data cell "Item" of newItemData to "test2"
-- store theItemData in theDataSource for later retrieval
set associated object of newData to theItemData
-- delete the Category data
delete newItemData
--Pull out theItemData, put back into table
-- This is the part that does not work
set testData to associated object of newData
set data source of table view "Item" of scroll view "Item" of theObject to testData