Re: Direct2Web ordered to-many relationship
Re: Direct2Web ordered to-many relationship
- Subject: Re: Direct2Web ordered to-many relationship
- From: Ramsey Gurley <email@hidden>
- Date: Thu, 05 Jul 2012 08:25:25 -0700
On your Recipe entity class add:
public void addToSteps(Step eo) {
//Set step value…
includeObjectIntoPropertyWithKey(eo, "steps");
}
public void removeFromSteps(Step eo) {
//Update step values…
excludeObjectFromPropertyWithKey(eo, "steps");
}
Ramsey
On Jul 5, 2012, at 2:14 AM, Amy Worrall wrote:
> I have a Recipe which can have any number of Steps. Each Step can only
> be attached to a single recipe. The Steps have an order, which is
> stored in a stepOrder property on the Step itself.
>
> I'd like the user to only interact with Steps in the context of a
> Recipe, so I'll make it display the steps as an inline edit
> relationship when editing a Recipe.
>
> The question is how best to deal with the ordering? Ideally I'd like
> these things to happen:
>
> * Steps are always numbered within a recipe 1, 2, 3, …
> * The user can't enter step numbers directly. Creating a new step adds
> it to the end of the list with the appropriate number.
> * Step numbers are displayed to the user, as read only.
> * By each step is an "Up" and a "Down" button. Press "Up" and it swaps
> the step in question with the one above it, changing the numbers as
> appropriate.
> * If a step is deleted, all the numbers of the remaining steps shuffle
> up to remain continuous.
>
> Is there any built in D2W-friendly way to work with an ordering like this?
>
> Thanks,
>
> Amy
>
> _______________________________________________
> 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
_______________________________________________
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