Re: table row numbers with NSArrayController
Re: table row numbers with NSArrayController
- Subject: Re: table row numbers with NSArrayController
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 26 Dec 2003 01:53:04 -0800
On Dec 26, 2003, at 1:12 AM, Daryn wrote:
I must have missed mmalc's response. All I'm really searching for is
an absolute row number in the table, not the object's index, so it
would seem using an index in the model wouldn't work. Or am I
misunderstanding?
My response was off-list to one of Scott's posts.
I certainly misunderstood your intent -- I thought you wanted the index
of the object in the array rather than "simply" the table row:
On Dec 24, 2003, at 2:33 PM, mmalcolm crawford wrote:
On Dec 24, 2003, at 11:43 AM, Scott Anguish wrote:
there isn't a binding or option for that, no.
I can't think of a way to do that that wouldn't be pretty hacky,
aside
from having the model object have a key that can return the index of
an
object in the array.
I think even that would be very difficult -- the item is retrieved by
NSBinder, which is the object which knows what index it's asking for.
The controller never -- as far as I can see -- gets a look-in. The
model object probably couldn't reliably contain an index since the
binding is usually to arrangedObjects, so you don't necessarily have
the same ordering, or even the same array. If you could get the
current object from the binder, then you could try to get
indexOfObject from arrangedObjects, but I don't think that's possible
either.
Even getting the row number will, I fear, be difficult. I can't
currently see any "way in". As mentioned above, it seems to be
NSBinder which controls the array, and which "knows" what index is
being asked for at any point, e.g.
- (id) _valueForKeyPath: ofObject: atIndex: raisesForNotApplicableKeys:;
None of "your" objects is directly involved in the process.
Now that I have been spoiled by controllers, I really don't want to
have to add a datasource just for this simple behavior. Someone needs
to please devise a clever solution,
As implied above, I don't at the moment *think* there will be a
"clever" solution (although I'd love to be proven wrong). This is
something else worth submitting as an enhancement request...
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.