Thursday, 22 August 2013

Primefaces modelling multiple selection trees

Primefaces modelling multiple selection trees

I am having a problem related to the modeling of multiple checkbox
selection trees in the same page. What i am doing is wrapping each tree in
a datagrid like this:
<p:dataGrid value="#{evaluationReportController.questionGroups}" var="t"
styleClass="top-aligned-grid-cells" columns="1"
style="margin-bottom: 40px;">
<f:facet name="header">Va rugam sa bifati
intrebarile</f:facet>
<p:panel header="#{t.description}">
<p:tree id="question-tree" value="#{t}" var="node"
style="width: 100%"
selectionMode="checkbox"
selection="#{evaluationReportController.selectedQuestions[t]}">
<p:treeNode>
<h:outputText value="#{node}"
style="width: 120px"/>
</p:treeNode>
</p:tree>
</p:panel>
</p:dataGrid>
The relevant model data from the controller looks like this:
private Map<QuestionGroup, TreeNode[]> selectedQuestions;
....
public Map<QuestionGroup, TreeNode[]> getSelectedQuestions() {
return selectedQuestions;
}
public void setSelectedQuestions(Map<QuestionGroup, TreeNode[]>
selectedQuestions) {
this.selectedQuestions = selectedQuestions;
}
However i cant get checkbox selections to the model. Any ideas what i am
doing wrong? I am using PrimeFaces 3.5 and javaee web API 6.
Thank you.

No comments:

Post a Comment