I tried to use ajax and the f:attribute
option, but I can not redeem the required values, that is, the selected line and the value of input
. I'd like some help.
Thank you.
I tried to use ajax and the f:attribute
option, but I can not redeem the required values, that is, the selected line and the value of input
. I'd like some help.
Thank you.
Just create an attribute in your Bean of type:
Lista<SeuObjeto> selecionados;
Define in your dataTable that it can be selected, informing the selection attribute, pointing to the property that you defined just above and the rowKey, follows an example:
<h:form>
<p:dataTable var="selecionado" value="#{seuBean.suaListaObjetos}"
selection="#{seuBean.selecionados}" rowKey="#{selecionado.id}" >
<p:ajax event="rowSelectCheckbox" update="@form" />
<p:ajax event="rowUnselectCheckbox" update="@form" />
<p:ajax event="rowSelect" update="@form" />
<p:ajax event="rowUnselect" update="@form" />
<p:ajax event="toggleSelect" update="@form" />
<p:column selectionMode="multiple"/>
conteudo do dataTable...........
</p:dataTable>
</h:form>
Remembering that it has to be inside a tag <h:form></h:form>