Problem loading data into table (selection changed)

This should be easy, but I cannot get it to work correctly. I am trying to load data into a table, but before it is added to the table, the selection changed handler of the table is run. In fact it looks like the selection changed handler runs before the awake from nib is finished. A [NSinternalScriptError (8)] happens at the append theItemData line in the selection changed handler. After I get past the error, everything works fine. Changing selection does what it is supposed to.

How can I get this to work?

on awake from nib -- pseudo code
	make datasource of table
	append data to datasource -- currently bogus data, but will read a file in the future
end awake from nib

on selection changed theObject
	set selectedDataRows to selected data row of theObject --the_categories

	-- work on the selectedDataRows
	tell window of theObject
		delete every data row of theItemData -- reset the datasource
		append theItemData with contents of data cell "Items" of selectedDataRows -- insert the data
		-- change the yet to be made text fields of CF#Name
	end tell
end selection changed

I know this is ancient and probably not point in replying but —

you have to get the contents out of the rows first, then delete, then add back. Because of course the rows themselves no longer exist after you’ve deleted them.