Re: NSOutlineView Not Updating After Adding Items
Re: NSOutlineView Not Updating After Adding Items
- Subject: Re: NSOutlineView Not Updating After Adding Items
- From: Quincey Morris <email@hidden>
- Date: Wed, 5 Aug 2009 23:02:48 -0700
On Aug 5, 2009, at 13:33, Mark Szymczyk wrote:
I'm using NSOutlineView and NSTreeController to display and edit an
NSXMLDocument on Mac OS X 10.5. The application uses bindings and is
based on the "Using Tree Controllers with NSXML Objects" example in
the Tree-Based XML Programming Guide. I get some strange behavior
when I add elements to the XML document.
If the parent has not been expanded in the outline view when I add a
new element to it, the outline view behaves properly. When I expand
the parent in the outline view I can see the new element has been
added. Once I expand the parent, a problem arises. Any new elements
I add to that parent do not appear in the outline view. Collapsing
the parent in the outline view and resizing the window do not help.
The elements get added to the XML tree. They're just not getting
added to the outline view. I know the elements are being added to
the XML tree because saving the document, closing it, and reopening
it makes the added elements appear in the outline view.
I have tried calling the outline view's reloadData method and the
tree controller's rearrangeObjects method. I have also tried calling
the outline view's reloadItem:reloadChildren method, but the outline
view still not does not update after expanding a parent element in
the outline view. What do I have to do to get the outline view to
display the proper information?
How are you "adding elements to the XML document"? If you're calling
add... methods on the NSXML... objects, you'd expect the sort of
results you're seeing -- AFAIK the proxy tree maintained by the
NSTreeController has no way of knowing that you changed the underlying
data model, since AFAIK KVO is not in operation for the tree
structure. Did you try constructing the NSXML... objects you want to
add, then tell the NSTreeController to add them?
_______________________________________________
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