why does selecting a parent not make me it's child?
why does selecting a parent not make me it's child?
- Subject: why does selecting a parent not make me it's child?
- From: Denis Stanton <email@hidden>
- Date: Mon, 14 Jul 2003 16:34:55 +1200
I hope someone can put me straight here. Maybe I'm expecting too much,
or maybe I'm overlooking the obvious.
I have two entities with a one to many relationship. For arguments
sake they can be classes Parent and Child
I have an editing WOComponent containing a WOForm allowing me to change
any of the fields for myChild, an instance of Child
One of the objects in the WOForm is a PopUpButton that lists all
available instances of Parent, as previosuly loaded into NSMutableArray
parentArray
PopUpButton1: WOPopUpButton {
displayString = parentItem.name;
item = parentItem;
list = parentArray;
noSelectionString = noParent;
selection = child.parent;
}
If I use this pop up to chose a different parent, and then click
Submit, which saves the changes, the child now has a new parent.
Unfortunately the same page also lists all the parents and the children
for each. After performing the above operation I see that two parents
are now claiming the child. The child appears to be a member of the
array oldParent.childs() and also of newParent.childs() (apologies for
the odd grammar)
If I restart my application (I'm working in dev mode) it would appear
that EOF recalculates oldParent.childs() array, correctly omitting the
Child that has been moved. Obviously this is not the best way to
update the data display.
Is there an easier way to remove the child from oldParent.childs() ?
The above editing operation does not require me to write any java code
to change the child -> parent relationship. If I have to remove the
child from one parent and add it to another manually I will have to
keep some separate record of the previous parent. It's starting to
look messy, and in my experience messy code usually means I just
haven't understood how to do something properly.
Thank for your kind attention in reading this far
Denis
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.