Redeem values of the selected inputs in the DataTable of primefaces [closed]

0

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.

    
asked by anonymous 24.01.2015 / 04:34

1 answer

1

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>

    
26.01.2015 / 19:32