Search code examples
objectdatatablerowicefacesace-editor

Icefaces - ace:datatable with more than 1 value


I would like to have an ace:datatable where I can compare an "old" object against a "new" object. Unfortunately I can only use List of Object to handle only one Object per row. Is it possible to handle more than one object per row?


Solution

  • If both lists will have always the same size you could try something like this.

                        <ace:dataTable value="#{bean.oldList}" var="item" rowIndexVar="index">
                        <ace:column headerText="Old Value">
                            <h:outputText value="#{item.value}"/>
                        </ace:column>
                        <ace:column headerText="New Value">                            
                                <h:outputText value="#{bean.newList[index].value}"/>                              
                        </ace:column>                  
                    </ace:dataTable>
    

    However i don't really like this because it can lead to index out of bound exception Perhaps you could also try playing with nested datatables.