Re: Table view active sorting and filter as model changes...
Re: Table view active sorting and filter as model changes...
- Subject: Re: Table view active sorting and filter as model changes...
- From: "Shawn Erickson" <email@hidden>
- Date: Thu, 24 May 2007 14:16:28 -0700
On 5/24/07, mmalc Crawford <email@hidden> wrote:
On May 23, 2007, at 7:03 PM, Shawn Erickson wrote:
> On 5/23/07, Shawn Erickson <email@hidden> wrote:
>> So I subclassed NSArrayController and implement the following. I now
>> have the behavior I want.
>
> Actually ... I take it back it isn't working as I want. It looks like
> the array controllers only observe its current selection (or selected
> objects) and I believe only for keys that have view objects bound to
> selection.<somekey>.
>
Oh, heavens, I'm sorry; somehow after I wrote:
"The problem, though, is that in general the table view won't know how
a model has changed. Although what you're proposing may be reasonable
if, say, someone changes a value in a detail field or if a value is
changed by an Apple Script, what happens when a user edits a value in
a table view that causes the row to be re-sorted or worse removed...?"
I got it into my head that in your case the only row being affected
would be the one the user is currently editing.
No worries.
Given your actual circumstances there are several approaches, but they
basically boil down to, yes, you'll have to observe the content
objects, somehow.
Thanks for confirming what I was seeing. :)
The cost of observation isn't particularly high, but there are some
things you could do to reduce the overhead of registration, in
particular you could provide a single key that's dependent on all the
keys that affect sorting and filtering and observe only that -- the
GraphicsBindings example at <http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
> gives an example.
I will take a look and give it some thought.
There are perhaps a couple of other things you could do, but I want to
do a little more investigation before suggesting anything more
radical...
Thanks for your assistance so far.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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