Re: NSArrayController can't insert object
Re: NSArrayController can't insert object
- Subject: Re: NSArrayController can't insert object
- From: Scott Anguish <email@hidden>
- Date: Mon, 10 May 2004 16:04:12 -0400
On May 10, 2004, at 10:56 AM, Timothy Larkin wrote:
I have a window with two tables. One table shows the result of
searches of the Library of Congress. The other table shows the
contents of my library. When the second table shows all the records,
I can drag items from the LOC table and add them to my local table.
My local table also has an NSSearchField that can filter the items
shown in the table. The problem comes when the local table shows a
subset of my entire library. If I drag a new item from the LOC table
to the local table, an exception is raised by [NSArrayController
_assertFilterRestrictsInsertionOfObjects:atArrangedObjectIndexes:],
and the item is not added. (This happens whether or not the search
string in the NSSearchField would select the new record.) However, if
the book from the LOC table is the same book as one that appears in
the filtered local table, the assertion is not triggered, and the
addition is allowed to complete.
What is this filter that's implied by
_assertFilterRestrictsInsertionOfObjects? It seems as though there's
some rule saying that if the arranged object array is not the same set
as the content array, new items cannot be added to the arranged object
array.
Yep, this is a known issue.
If the new item doesn't fit the filter, you get this happening.
You could modify the filter so that items that fit the criteria, or
have NULL values for the criteria are displayed. You could also
explicitly have it included in the filter in some other manner
(overriding arrangeObjects: in both cases).
Finally, the easiest option might be to disable the filtering
automatically when you drag in a new item. It's not likely the best UI
experience, but better than dragging it in, and having it disappear
immediately because it gets filtered.
You could also change the way the insert is done.. how are yo udoign
it now?
_______________________________________________
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.