appending data to a table view

i am running a repeat loop and i want to append every item (stored in variable) to a table view, while to the loop is happening.

doing this is not as obvious as i had hoped, so i need help
thanks

Assuming your created a data source for the table view already, you can use the following to add items. For every column you have, you’ll need to duplicate the “set contents of data cell…” line. If you uncomment the two commented parts, the updating will take place after all of the items have been added, otherwise the items will be updated one by one as they are processed in the repeat loop.

set theList to {"Item 1","Item 2","Item 3","Item 4"}
set theDataSource to data source of table view "theTableView" of scroll view "theScrollView" of window "theWindow"
--set update views of theDataSource to false

repeat with listItem in theList
	tell theDataSource
		set theRow to make new data row at the end of the data rows
		set contents of data cell "column1" of theRow to listItem
	end tell
end repeat
		
--set update views of theDataSource to true

j