[still newbie] How to redisplay correctly a WODisplayGroup after deleting an EO
[still newbie] How to redisplay correctly a WODisplayGroup after deleting an EO
- Subject: [still newbie] How to redisplay correctly a WODisplayGroup after deleting an EO
- From: Erwin <email@hidden>
- Date: Sun, 10 Oct 2004 16:55:44 +0200
sorry, could not find any hint in archives...
In my "ListContactPage", I display a list of Agent's contact entities in a WODisplayGroup (master "Agent"- details "contacts") works fine... (with 'fetches on load' option selected )
public ListContactPage(WOContext context) {
super(context);
this.takeValueForKeyPath(((Session) session()).agent(), "agentContactDisplayGroup.masterObject");
}
.......
then I select one contact to view the contact info in a "ContactDetailPage"
public WOComponent viewContactInfo(){
ContactDetailPage nextPage = (ContactDetailPage)pageWithName(");
nextPage.setTheContact(aContact);
return nextPage;
}
In my "ContactDetailPage" I can delete the displayed contact
public void setTheContact(EOEnterpriseObject aContact){
theContact = aContact;
}
public ListContactPage deleteContact(){
Agent contactAgent = ((Contact) theContact).agent();
contactAgent.removeObjectFromBothSidesOfRelationshipWithKey(theContact,"contacts");
EOEditingContext ec = session().defaultEditingContext();
try {
ec.deleteObject(theContact);
ec.saveChanges();
} catch (Exception e) {
ec.revert();
NSLog.err.appendln("An exception occurred while trying to remove a contact: " + e);
}
ListContactPage nextPage = (ListContactPage)pageWithName("ListContactPage");
return nextPage;
}
But when the ListContactPage redisplay, the deletec contact is still in the WODisplayGroup... i know it has been deleted from the database .. (if I restart the woapp, I don't get it anymore in teh WODisplayGroup...
si it seems to be a problem of doing a new fetch from the database, WODisplayGroup should do it itself on reload... ,,
_______________________________________________
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