Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

To dynamically add JSF/Primefaces selectonemenu pairs one below the other  RSS feed

 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement a functionality which has a list of selectone menu pairs(like name value pairs) which gets loaded from the database.This is available in MS access application and i am trying to replicate the same in my JSF application.The screen shot of the end part of the menu list is attached with this post.

Can someone please guide how to implement the same functionality in my JSF/Primefaces app where the menu pair list is loaded from the database table dynamically.Also i must another get the blank pair at the end as soon as i start selecting the existing blank menu at the end.Any help/hints would be really helpful as i need to implement this in my project.
Capture.JPG
[Thumbnail for Capture.JPG]
selectone menu pair list
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello let me get this straight. You want to select the name (left select menu) and the state (right select menu) get updated/changed or vice versa?

If so, it's not that hard :)

In the backing bean: Set up 2 lists for data (name and states) and 2 select item lists List<SelectItem>. Populate them accordingly.

In JSF: set up 2 select one menus, fill it up with the select item lists accordingly.

Then add in AJAX for name select one menu: <p:ajax event="valueChange" process="@this" update="stateMenu" listener="#{backingBean.updateStateMenu}" />

The updateStateMenu takes in AjaxBehavior parameter.

The key is how you link the name-state pair together in the ajax methods.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!