I have a nested datatable using rowExpansion. Content for each nested table loads correctly when expanding a row. However, when a filter is applied to the root table, content is loaded for all nested tables. If there are a lot of lines, it kills the performance.
Note that this is not a "JSF calls getters multiple times" problem. Content for extended lines is cached in the background. It behaves as if each individual row expands before applying the filter. Please note that the filter refers only to the value property, and not to the "lines", which are rich content.
<p:dataTable value="#{backing.elements}" var="row"
filteredValue="#{backing.elementsFiltered}">
<p:column>
<p:rowToggler />
</p:column>
<p:column headerText="Value" filterBy="#{row.value}">
<h:outputText value="#{row.value}" />
</p:column>
<p:rowExpansion>
<p:dataTable value="#{row.strings}" var="string">
<p:column headerText="Strings">
<h:outputText value="#{string}" />
</p:column>
</p:dataTable>
</p:rowExpansion>
</p:dataTable>
Bean support:
@Named
@ViewScoped
public class Backing implements Serializable {
private List<Element> elements;
private List<Element> elementsFiltered;
@PostConstruct
public void init() {
}
public List<Element> getElements() {
return elements;
}
public List<Element> getElementsFiltered() {
return elementsFiltered;
}
public void setElementsFiltered(List<Element> elementsFiltered) {
this.elementsFiltered = elementsFiltered;
}
}
Entity:
public class Element {
private String value;
private List<String> strings;
public String getValue() {
return value;
}
public List<String> getStrings() {
if (strings == null) {
}
return strings;
}
}
This is mistake? Or am I doing something wrong here?
5.3.0, JSF 2.2, Java EE 7.0