Friday, April 26, 2013

Task Flow And Switcher Example


The next example show how to switch between two fragments in the same task flow by using the switcher .

Use Case : The user can explore the hierarchy of departments and explore the hierarchy of employees by selecting from the menu in the left corner of the screen 

The hierarchy of departments


The hierarchy of employees

One of the solutions that can be used is the use of dynamic region, but in my case I will use a different technique which consists of a single task flow with 2 fragments and switcher

Implementation steps :
  1. create a task flow (fragment)
  2. create a switcher and 2 fragments , one for  hierarchy of departments and one for hierarchy of employees
  3. define cases for the switcher
  4. add the task flow to a consumer page as a region 
  5. create menu and add setPropertyListener to menu items
  6. add partial trigger to the region 
  7. change Refresh' property for the task flow to "if needed"

Create the task flow with 2 page fragments and add the navigation cases 


create the region for the hierarchy of departments 


create the region for the hierarchy of employees 



Define a parameter in  the parameters section 


Define the cases of the switcher  :
if the value of choiceParam == 'dept' then go to hierarchy of departments
if the
value of choiceParam == 'emp' then go to hierarchy of employees



Add the task flow as a region to a consumer page
create a menu model
Add partial trigger for the region 


Add SetPropertyListener to menu items



In the consumer page :
  • go to the page definition
  • pass the value of the menu item to the task flow
  • change refresh ' property to "ifNeeded"


No comments:

Post a Comment