Question

I get a very strange behaviour when I combine the accordionPanel (dynamic tabs) together with a dataTable. In my project the total amount of dynamic tabs can get really big (>1000) so I really need the dynamic loading of the accordionPanel working, otherwise it is way too slow.

The problem

Instead of only loading the datatable for the currently selected tab, the getter method to load the elements from a list variable is being called 6 times the total amount of dynamic tabs. So if I have 300 dynamic tabs, the getter method is called 1800 times. If I however do not use a dataTable but i.e. just output text, the getter method is only called once like it should be.

Here is a small working example which produces the unwanted behaviour:

xhtml

<p:accordionPanel id="datasetHistoryAccordionTab" value="#{Bean.orderDatasets}" var="dataset" dynamic="true">
                            <p:tab title="Dataset ##{dataset.id}">
                                <p:tabView>
                                    <p:tab title="All Processes">
                                        <p:dataTable value="#{Bean.datasetProgressHistoryAll}" />
                                        <!-- <h:outputText value="#{Bean.datasetProgressHistoryAll}" /> -->
                                    </p:tab>
                                </p:tabView>
                            </p:tab>
</p:accordionPanel>

Bean

@ManagedBean
@ViewScoped
public class Bean implements Serializable
{
    private List<DatasetBE> orderDatasets = new ArrayList<DatasetBE>(300);      
    private List<DatasetHistoryBE> datasetHistoryAll = new ArrayList<DatasetHistoryBE>();

    public List<DatasetBE> getOrderDatasets() {
        return orderDatasets;
    }

    public void setOrderDatasets(List<DatasetBE> orderDatasets) {
        this.orderDatasets = orderDatasets;
    }

    public List<DatasetHistoryBE> getDatasetHistoryAll() {
        log.debug("getDatasetHistoryAll() called...");
        return datasetHistoryAll;
    }

    public void setDatasetProgressHistoryAll(List<DatasetHistoryBE> datasetHistoryAll) {
        this.datasetHistoryAll = datasetHistoryAll;
    }
}

The initial state is OK but as soon as I change to another tab the getter method is being called like crazy...

Is this a bug in PrimeFaces or am I doing something wrong? In my project I still use PF 3.5 but for testing purposes I also tried PF 4.0 but the same strange behaviour applies... Any help would be greatly appreciated!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top