Re: dependent lists in D2W
Re: dependent lists in D2W
- Subject: Re: dependent lists in D2W
- From: Fabian Peters <email@hidden>
- Date: Sun, 21 Dec 2014 11:54:00 +0100
Hi Ted,
You can use Ramsey's AjaxNotifcationCenter for this. The code has moved here: <https://github.com/wocommunity/wonder/tree/master/Archives/Frameworks/AjaxLook>
You'll need a few rules, along these lines:
80 : propertyChangedDelegate != null => aboveDisplayPropertyKeys = ("ajaxNotificationCenter") [com.webobjects.directtoweb.Assignment]
100 : ((task = 'create' or task = 'edit') and entity.name = 'Person') => propertyChangedDelegate = "your.app.d2w.delegates.PersonPropertyChangedDelegate" [ERDDelayedObjectCreationAssignment]
120 : ((task = 'create' or task = 'edit') and entity.name = 'Person' and (propertyKey = 'isFemale' or propertyKey = 'salutation')) => componentName = "AjaxObservingSwitch" [com.webobjects.directtoweb.Assignment]
100 : ((task = 'create' or task = 'edit') and entity.name = 'Person' and propertyKey = 'isFemale') => customComponentName = "ERD2WCustomEditBoolean" [com.webobjects.directtoweb.Assignment]
100 : ((task = 'create' or task = 'edit') and entity.name = 'Person' and propertyKey = 'salutation') => customComponentName = "ERD2WEditString" [com.webobjects.directtoweb.Assignment]
And you need to implement PropertyChangedDelegate to tell the notification center which containers should be updated:
public class PersonPropertyChangedDelegate implements PropertyChangedDelegate {
public NSArray<String> propertyChanged(D2WContext context) {
String prop = context.propertyKey();
if (Person.ATTRIBUTE_isFemale.equals(prop)) {
return new NSArray<String>(Person.ATTRIBUTE_salutation);
}
return NSArray.emptyArray();
}
}
Make sure your page component has the "aboveDisplayPropertyKeys" section.
HTH, Fabian
P.S.: Why was the code moved to the archives and not integrated into ERDirectToWeb?
Am 21.12.2014 um 03:33 schrieb Theodore Petrosky <email@hidden>:
> i have these relationships
>
> PersonBook toOne Book toOne Show
> PersonBook toOne Person
>
> When I am creating a new personBook, I want a Show popup that lists all shows. if I select the Show, the Book popup is given the short list of books for that show.
>
> So, with no Show selected the Book list would be quite long.
>
> I am looking at the Ajax dependent popups and I have done this before in a regular Wonder app, but never in D2W.
>
> Is there a component to create this dependent popup setup in D2W?
>
> Maybe I need to rethink the whole structure of the database.
>
> Ted
>
> _______________________________________________
> 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