Re: Adding an Object to an Array that doesn't exist in database
Re: Adding an Object to an Array that doesn't exist in database
- Subject: Re: Adding an Object to an Array that doesn't exist in database
- From: Dev WO <email@hidden>
- Date: Thu, 26 May 2005 00:59:25 +0200
Of course it works, of course it's what I was looking for... of course
I feel really stupid:)
I might register for the second WWDC seminar:)
Thank you all
Xavier
Way easier than any of that. Add this binding to the popup:
noSelectionString = "none";
Chuck
On May 25, 2005, at 3:36 PM, Dev WO wrote:
Hi guys,
I don't know if I'm going to the right direction, but here's what I
have:
I've got an Item that has (among other things) a popup menu that
lists OtherItems' name available in a table (this is to register the
father of the item).
What I wanted to do is to add another "virtual" name in this popup
menu to allow choosing "none".
So I created another instance of Item called "unavailable" and added
it to the beginning of the array:
itemList.insertObjectAtIndex(unavailable, 0);
So this seems to work and I've got an new item of the beginning of
the father's popup menu with "unavailable".
Then here's the part I've a problem with:
I'd like to add (or update) an Item, and I'd like to keep the
item.fatherName to NULL if "unavailable" is selected and the correct
item if a "real" father is selected.
But when I'm trying to save, I got a crash complaining about an
object which isn't in the editing context...
here's my save method:
public WOComponent addOrUpdateItem()
{
if (!itemList.containsObject(item))
{
// checking if unavailable is selected
if (item.itemName().equals("Unavailable"))
{
// setting the item father's name to NULL
item.setItemName("");
}
itemList.addObject(item);
ec.insertObject(item);
awakeFromInsertion(ec);
item = new Item();
}
else
{
awakeFromInsertion(ec);
item = new Item();
editMode = false;
}
ec.saveChanges();
return null;
}
So maybe there's an easier way to handle that;)
What I am thinking is that I should probably store the "selection" of
the WOPopupMenu to something else than directly item.itemFather and
then evaluate the value of this new object...
Could anyone provide me with a tip (or 2;))
Thanks a lot
Xavier
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
village.net
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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