Re: Sorting issues with NSTableView
Re: Sorting issues with NSTableView
- Subject: Re: Sorting issues with NSTableView
- From: mmalc crawford <email@hidden>
- Date: Wed, 18 Jul 2007 11:21:09 -0700
On Jul 18, 2007, at 10:24 AM, Patrick M wrote:
It is strange, from my perspective, that it returns the dislay
index, which is of no use in any context, except maybe in updating
the display manually, but that is working fine.
Umm, the display index is generally useful for manipulating the
displayed objects.
You're passing responsibility to the array controller to manage
display, so it's reasonable for it to communicate in its "units". You
also need the display index for actions such as drag and drop.
The remove button might work in this case, though I iwll ultiamtely
apply this solution to another case where the displayed array is
kept in synch with another associated data array, and the indexes
must match in that case as well. The remove button would not work
in that case, and for adding, i present a file dialog to select
files, which does not work with the add: method of the array..
You seem to be making things remarkably complicated.
What are you trying to achieve?
> How do i find the object in the array associated with the index
> returned
> from the display?
>
id objectAtTheDisplayIndex =
[[arrayController arrangedObjects]
objectAtIndex:theDisplayIndex];
I have not tried this, but it seems to use the display index to
index into the array manually. If the array is not sorted (as mine
is not) this will return the wrong object...
No, it won't.
I have since found that
[myArrayController removeObjects:[myArrayController selectedObjects]];
works.
This is exactly the same as sending the array controller a remove:
message.
Again, what are you trying to achieve?
mmalc
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden