0

It's the first post I wrote here, so, please be kind to me if I'll do something wrong (and please, excuse my English ...)

Well, my problem is that I have to use a DataTable to show some data. Data is contained in some Lists. Every list is a different column, so I have x list to show x columns.

I've tried this way, but it shows non result (blank table):

<p:dataTable value="#{ass.colonne[0].value}" varStatus="srows" var="itemColonna" id="tableAssociazione" styleClass="uc-table-style" resizableColumns="false" reflow="true">
    <p:column id="status" resizable="false" width="35" styleClass="text-center" headerText="">
        <span class="circle-status #{ass.configurato?'green':'red'}"></span>
    </p:column>
    <ui:repeat var="cols" value="#{ass.colonne}" varStatus="scols">
        <p:column id="colonna_${tsrows.index}_${tscols.index}" resizable="false" styleClass="text-center" headerText="#{cols.labelColonna}">
            <h:outputText value="${ass.colonne[scols.index].value[srows.index].outputVal}"/>
        </p:column>
    </ui:repeat>
</p:dataTable>

No Error messages are displayed, so I don't know what's happening.

Thanks everyone for your cooperation.

Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
  • 1
    Hi, please edit your question and make sure the code you posted is visible (look at your own question, it is missing (you can always see that in the preview too). USe indentation or the 'code' button on the editor. And please make sure you have a [mcve] and post jsf and PrimeFaces version info. (and are you sure you use jsp?, modern PrimeFaces does not support JSP and for JSF it has been deprecated 7-8 years ago in favour of facelets) – Kukeltje Jul 09 '19 at 15:19
  • Possible duplicate of [How to use ui:repeat in datatable to append columns?](https://stackoverflow.com/questions/25724111/how-to-use-uirepeat-in-datatable-to-append-columns) – Kukeltje Jul 09 '19 at 15:32
  • @VasilLukach: Please let the the editing be done by the OP if they are new contributors, so they learn how to do the editing/formatting... Cheers – Kukeltje Jul 10 '19 at 10:55

1 Answers1

0

I think that you see a blank table because you don't use the datatable var itemColonna in the outputText. As you can see in the datatable showcase the items to be represented in the datatable must be referred from the datatable var.

I also suggest you to review your data model and to use Dynamic Columns to generate a dynamic column numbers

Alexcat
  • 87
  • 4
  • No, You can put whatever you want in the output of colums without ever refering to the var of the datatable... Effectively your second paragraph remains which is exactly what the suggested duplicate is about. – Kukeltje Jul 11 '19 at 10:39