Thursday, April 7, 2011

Cascading LOV Using Bounded TaskFlows

This is part 2 of my initial post regarding Bounded TaskFlows used as an LOV.

ADFDeveloper - Applied - #69 Code Corner - LOV Using Bounded TaskFlows

Just as an add-on to my post, I decided to make it one step tricker by introducing a cascading effect in my List-of-Values where data comes from a WebService.

What I'm using is a DropDown of Locations and only Locations which as Departments (since we don't want empty results now hehehe). Of course, we don't want to get lazy now so I also made this DropDown to also use a WebService, and to improve performance, I keep the initial fetch in a ViewScope bean.

Default View

Location DropDown

I also modified the LOV to show the Location registered for the Department, for clarity hehe.

List of Values

The add-on was pretty straightforward, just include it as parameter in the setPropertyListener upon launch of LOV.


TaskFlow

One extra thing that needed to be handled though was the validation. This time around we're not just validating to whether the departmentId is valid, but rather the departmentId needs to be valid based on the set locationId as well.

This part can be implemented in a number of ways, but I chose to add the attribute as part of the validating component.




And there you have it! 2 layers of LOV that relies on a WebService datasource.