JSF + Primefaces p: selectOneRadio within Datatable and Pagination

1
<p:dataList value="#{simuladoBean.questoes}" var="q" type="unordered"
                rowIndexVar="qi" itemType="none" paginator="true" rows="1"
                styleClass="paginated">

      <h:panelGrid columns="2" style="color:#000;"
                        rendered="#{q.tipo == simuladoBean.certoErrado}">
                        <p:outputLabel for="resposta" value="Resposta: " />
                        <p:selectOneRadio id="resposta" value="#{simuladoBean.resposta}"
                            style="color:black;width:auto;">
                            <p:ajax listener="#{simuladoBean.processaResposta}" />
                            <f:selectItem itemLabel="Certo" itemValue="Certo | #{q.id}" />
                            <f:selectItem itemLabel="Errado" itemValue="Errado | #{q.id}" />
                        </p:selectOneRadio>
     </h:panelGrid>
            </p:dataList>

My ManagedBean is as @Named and @ViewScoped .

import javax.inject.Named;
import javax.faces.view.ViewScoped;

The code works normally, but when I go from page to page (Pagination), when I return to the previous page, radiobutton is unchecked, ViewScoped does not work for SelectOneRadio . How do I keep Selectoneradio as viewScoped , so that it is marked for example right on the first page when moving to the second and returning to the first one the 'right' is still marked?     

asked by anonymous 21.06.2016 / 01:53

0 answers