Re: refreshing and relationships
Re: refreshing and relationships
- Subject: Re: refreshing and relationships
- From: Dev WO <email@hidden>
- Date: Sun, 15 Jan 2006 22:44:38 +0100
Hi Tom,
did you try Arturo's tip?
Regarding what I gave you, you've got to call the NSMutableArray in
your WOComponent that display the list and no more the object's
relationship.
As far as I understand it, the relationship doesn't display the
expected array because the relationship comes from the datastore and
not the editing context so even if you remove in the editing context,
it's not "updated" back to the relationship because it's not actually
saved.
The refreshing "action's" like refreshObject only "force" a refresh
from the datastore, so as it hasn't been saved, you'll get the
original array and not the edited one.
I don't know what's the best approach about managing relationship
inside an editing context, but I really think what I gave you should
work (even if it's not the best way to do it).
You might get more help tomorrow;)
Xavier
That doesn't seem to work. I tried it before and/or after the call
to deleteObject and in conjunction with invoking refreshObject on
the owning sourceObj. No combination seems to work.
Thanks
Tom
On Jan 15, 2006, at 1:29 PM, Arturo Pérez wrote:
On Jan 15, 2006, at 12:33 PM, Tom Woteki wrote:
I have a source object, sourceObj, with a to-many relationship.
Say the relationship key is "targets" . I obtain the related
objects by invoking sourceObj.targets() where the method targets
() returns an NSArray as a cover for a call to storedValueForKey
( "targets" ).
I now invoke:
/* Assume editingContext exists and all EOs are in it */
editingContext.deleteObject( aSpecificTargetObject )
You also need to do a
removeObjectFromBothSidesOfRelationshipWithKey. If the sourceObj
"owns" the deleted object that's all you have to do.
-arturo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anazys.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden