Deleting All Rows of a Table View

Hi,

I’m looking for a way to delete all rows of a table view (I can’t even find how to delete one row)…
I’m thinking of an equivalent of the AplleScript Studio command below.

set contents of table view "TableView" of scroll view "ScrollView" of window "main" to {}

Maybe if someone know how to delete one row, I can delete them all in a repeat loop or something like that?

Thanks in advance.

Depends on the way you are set up.

I’m not completely sure what you mean. I guess by adding a row to the datasource?

What Richard is asking is whether you set up your dataSource using the table view delegate methods or bindings.

If you are using an NSMutableArray, which is what I am assuming:

dataSource's removeAllObjects()

or the AppleScript equivalent {}

set dataSource to {}

To remove individual rows, you need to get the row number and then remove it from the dataSource.
Look under NSMutableArray in the documentation to see the methods.

Okay, thanks, that’ll do it.

I don’t think I heard half the ways to do it Craig :lol: