I have a primefaces datatable with a multiple selection column. I want to be able to set the selected (checked) rows upon load. I will have the desired selected rows from a service call in the post construct, but I need to know where to pass those values so when the page loads, it checks certain rows.
0
votes
1 Answers
0
votes
for example:
<p:dataTable id="mainDataTable" var="pm" widgetVar="dt"
value="#{generarPreMatriculaBean.preMatriculas}" rowKey="#{pm.id}"
selection="#{generarPreMatriculaBean.preMatriculasSelec}"
styleClass="datatable_style_general" scrollable="true"
rowIndexVar="rowIndex"
emptyMessage="No se encontrĂ³ registros"
rowStyleClass="#{pm.generado == true ? 'old' : null}">
for set selection you have to init property preMatriculasSelec when you are in INIT METHOD OF BEAN:
@PostConstruct
public void init(){
preMatriculasSelec = something;
}
And selection will be checked on view.