slideMenu and selected submenu value - jsf

I have a tree of categories (types) to be showed inside a <p:slideMenu>, I want to select the category showed inside the label of <p:submenu>, and not show its subcategories (contained inside a list of <p:menuitem> tags).
Is there any way to solve this issue, for example add a button in front of each <p:submenu> and when I click the button the current <p:submenu> is selected and its value is sent to a backing bean, and when I click on the label contained inside <p:submenu> the subcategories will be shown.
I am using primefaces 3.5.

Related

JSF datatable - method always gets called with last element in datatable

I have component thats basically datatable made of list of buttons. Each button opens dialog thats another component, and passes current var of datatable to this component (dialog). Inside dialog there is button that submits element and text. This command button has actionListener=#{beanClass.beanMethod(cc.attrs.passedListElement)}. Problem is element passed to method is always last element in datatable, even if i click in middle element of datatable. Why its happening?

Create dropdown list jsf

Currently i'm stuck in create two dropdown list in jsf by click a "Add" button.
Initial i have a form with two dropdownlist, a "Add" button and a "submit" button.
The first dropdownlist is list country. The second dropdownlist is list city.
When user choose a country then the second dropdownlist will add dynamic city of this country(i done this using ajax f:ajax).
how can i add two other dropdownlist(list country and list city also) when add button clicked?(it mean user can add a lot of pair dropdownlist using add button)
how about structure of bean to manage all pair dropdownlist when i click submit button?
Please give me some example code to do it.
Thanks
Have you tried using c:forEach? Similar to the following:
<c:forEach var="i" begin="1" end="#{bean.numberOfAddsCLicked}" step="1">
<!-- Your elements to repeat here. Probably bind their values to bean.country[i] respective bean.city[i] with country and city being arrays of bean.numberOfAddsCLicked -->
</c:forEach>

How to get the selectManyCheckbox row entire values to the list using JSF and datatables

Select Many Check box items to Cart :
Declare check box first column of data
Declare the command button to the above the data
Once user click the check box current row data add to the list and this list data go to the Cart page
On click the check box current row data add to the list and on submit the button the entire list data go to the Cart page.
Thanks in Advance.
You can use primefaces datatable component for select one or more rows from a table and send this information to everywhere.
Take an example of this in showcase (the datatable have many others options too).

Primefaces tabview menu

Im having a problem with Primefaces tabview. It's tabs consists of selectOneMenu elements that look like this:
`
<p:selectOneMenu value="#{bean.currentItem.marketType}">
<f:selectItems value="#{bean.marketTypes}"/>
</p:selectOneMenu>
`
Now, I show this view as a dialog every time i select row from a dataTable (in order to edit selected record). The strange behavior is: the first time I refresh the page, i select the row, and the dialog pops out correctly. In all tabs of a tabview, all selectOneMenu elements shows correct data for selected record. However, when i close dialog and reopen it by selecing row again, only those selectOneMenu elements shows correct data, which where in a selected tab from a tabview before the dialog was closed.
Does any one know how to keep data in all tabs every time I open a dialog without refreshing the page?
Solved, there is a bug in Primefaces that is described here:
Primefaces tabView executes form validation on tab change

How to use <h:selectOneRadio> on more than one datatable

I'm trying to achieve the well known feature of being able to select a datatable's row by using a radio button.
I have followed this blog:
http://balusc.blogspot.com/2006/06/using-datatables.html#SelectRowByRadioButton
It works perfectly if there is one datatable on the form, but when I add another one (even if it's placed on other form), and try to select a row there, the radio button gets selected then instantly unselected. The data is correctly set on the backing bean though.
Any ideas about how to extend the results of the above blog on more than one datatable?
Thank you
That script will group all radio buttons with the same component ID in the same form. So to fix your particular problem, put the other data table in a different form or give the other <h:selectOneRadio> a different ID.

Resources