I have used checkbox to select multiple rows from datatable. For those rows which have been selected i have given value 1 and for those rows which have not been selected i have given the value 0. I have saved the selected and unselected rows in a table with value 1 for selected row and 0 for unselected row. Now when i load the table again after save process i need list in such a way that those which have value 1 must be shown automatically checked in datatable and those which have value 0 must appear in the datatable unchecked. Is it possible to do that? My view code is as follow:
<p:commandButton value="#{text.Save}" id="cmdSave" style="margin-left:5px;"
action="#{schemeMapMB.saveMapping}" update="tblMapping" />
<p:dataTable id="tblMapping" var="val" scrollable="true" scrollHeight="300%"
value="#{schemeMapMB.lstSchemeMapping}" selection="#{schemeMapMB.selectedSchemeMappingLst}" rowIndexVar="row"
emptyMessage="#{text.NoDataFound}" rowKey="#{val.schemeId}">
<p:column selectionMode="multiple" style="width:6%"/>
<p:column headerText="#{text.SNo}" style="width:10%">
<h:outputText value="#{row+1}" />
</p:column>
<p:column headerText="#{text.SchemeName}" style="width:40%">
<h:outputText value="#{val.schemeName}" />
</p:column>
<p:column style="width:20%">
<h:outputText value="#{val.sltdChk=='true'?'1' :'0'}" >
</h:outputText>
</p:column>
</p:dataTable>
Aucun commentaire:
Enregistrer un commentaire