I'm using primefaces to implement my web site and I'm facing an issue.
I've used selectOneButton
component and depending on which button is selected I want to show a specific datatable. So when I click the button1 I want to show table1, and table2 when I click the button2.
This is the code I am using:
<p:selectOneButton
value="#{myBean.dataTableType}"
valueChangeListener="#{myBean.dataTableTypeChange}">
<f:selectItems value="#{myBean.dataTableTypes}"
var="type"
itemLabel="#{msg['datatable.type.'.concat(type)]}"
itemValue="#{type}" />
<p:ajax update="table1 table2"/>
</p:selectOneButton>
With this code, I'm unable to reach what I want :(
You should declare an attribute process for ajax with value
@this
. This attribute say toselectOneButton
to set value into bean when will happen some event forselectOneButtton
. And you will have an actual value for datatable type.Now you don't have it. And if you have a condition for example:
Condition return false..