Showing posts with label manage. Show all posts
Showing posts with label manage. Show all posts

Saturday, March 5, 2011

Cascading Dropdown List from Bean

I'll demonstrate how to build a dropdown list where the values are coming from your manage bean. A good useCase for this scenario is when you can't use a BC driven LOVModel and pretty much rely on a manage bean to build your list. In my example, i'm relying on a webservice to return me the list of possible dropdown items which i'll need based on a submitted locationId. On top of it, i keep this list in a pageFlowScope map so that once I have already fetched it, i don't do a refetch especially when i'm asking for the same location's departments.

For my sample, I have a table that contains items (generic) with a location Id. The HR schema has a table of Departments that can be filtered based on this locationId.

So the final running app looks like this.



And yes the departments are filtered based on the locaitonId. So now for the code.

PageFragment

BackingBean

PageFlowBean

A question was raised about how to refresh the list incase there was any dynamic change, the answer to that is to decrease the scope of the bean which holds our map.

Note:
retrieveDepartmentListFromDatasource(locationId) calls a webService to return a list of available departments.

Monday, February 7, 2011

Popup from Popup

There are many ways on how to launch a popup from a popup, and I'm going to demonstrate here a "backingBean-based" of launching this.

So why go programmatic? The reason for this is because most of the time, I would prefer launching one popup at a time, meaning  that when I call the second popup, I first make sure to close the current popup.

So a straight forward sample in launching the popup declaratively looks like this.





As you might already know, this is achieved by simply calling af:showPopupBehavior.

Now let's go for the programmatic approach in making sure we first close the current popup before launching a 2nd one. As I have already mentioned, there are different ways of achieving this without binding your popup to a bean by using javascript for example (see Invoke popup from a popup by Luc Bors ).





Cheers.