0
votes

I have a list of objects in a bean and I would like to display this list into a dataTable. Each row contains data of the object. But, i don't want to display all the objets in my dataTable.

<rich:dataTable id="myTable" iterationStatusVar="iterator" style="width: 100%; height: 100%" value="#{myBean.myList}" var="myObject">
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="#{bundle.name}"/>
                    </f:facet>
                    <h:outputLabel value="#{myObject.name}" rendered = "#{myObject.code == bundle.code}"/>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="#{bundle.type}"/>
                    </f:facet>
                    <h:outputLabel value="#{myObject.type}" 
                        rendered = "#{myObject.code== bundle.code}"/>
                </rich:column>
            </rich:dataTable>

This code displays only the objects which have myObject.code== bundle.code. But, my data table displays the others rows too (the columns are not informed).

Could you help me, please?

Thank you.

1

1 Answers

0
votes

Your bean could offer a method returning a filtered List, containing the desired objects only. Display that filtered list in your dataTable.

Or you could use an EL expression to filter the list, if you use the current EL version 3.0. #{myBean.myList.stream().filter(o->o.code == bundle.code)}"#