NSArrayController can't insert object
NSArrayController can't insert object
- Subject: NSArrayController can't insert object
- From: Timothy Larkin <email@hidden>
- Date: Mon, 10 May 2004 10:56:59 -0400
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.
Since [NSArrayController insertObject:atArrangedObjectIndex:] "inserts
object into the receivers arranged objects array at the location
specified by index, and adds it to the receivers content array", the
arranged object array will still be a subset of the content array, so
there shouldn't be any reason to forbid making additions to the
arranged object array.
Any way around this problem?
XCode = 1.1, OS X = 10.3.3.
Tim Larkin
Abstract Tools
_______________________________________________
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.