Hi
I have a problem which I gather is quite a common one, but I don’t seem to be able to find an adequate solution anywhere. It is the old unsorted data source vs. sorted table view problem.
My application contains a table view with two columns containing a list of files with a flag for each one. I want to be able to sort the table on either the flag or the filename, however, once the table is sorted, the order of the table view doesn’t represent the order of the data source.
The problem is that I want to select some of the files are perform an operation on them which may result in the file being removed from the list. As I loop throught the selected rows of the table I want to be able to delete the row from the view.
Here is the problem:
If I loop through using ‘selected data rows’ then the application works fine, except that I can’t deselect the rows which were selected before the loop - resulting in an inappropriate selection. I can cancel the whole selection at the end of the loop but I may want to stop the loop prematurely.
If I loop through using ‘selected rows’ I can cancel the selection for each row, but as the table has been sorted, there doesn’t seem to be any way to get at the correct data for the selected row.
Is there really no way of getting the corresponding data from a selected row in a table? It seems that you can only control the selection via indexed rows.
If there is some way I can get at the content of the text in the row of the table I can then search the data source manually for the correct data item as they are unique.
The only other solution I have seen is to use unix to sort the data source manually, but I’d rather not do that because of the time it takes to delete and recreate the entire data source…
Thanks in advance for any ideas…