2
I have a Datatable with several columns. One of them is a column that should display more than one attribute in each row of that column, as it is part of a Manytomany relationship. This column will receive attributes from a List. I want to know how to display more than one attribute in the rows in that column
The datatable with the column
<p:dataTable id="monografiasDataTable" widgetVar="monografiaTable"
value="#{gestaoMonografiasBean.listaMonografias}" var="monografia"
emptyMessage="Nenhuma informação a ser exibida" paginator="true"
rows="10" paginatorPosition="bottom" selectionMode="single"
selection="#{gestaoMonografiasBean.monografia}"
rowKey="#{monografia.id}" >
<p:ajax event="rowSelect" update="frm:toolbar" />
<p:ajax event="rowUnselect" update="frm:toolbar" />
<p:column filterBy="#{monografia.listaLinhaPesquisas[0].nome}" headerText="Linha de Pesquisa">
<f:facet name="filter" >
<p:selectCheckboxMenu value="#{gestaoMonografiasBean.listaMonografiasFiltradas}" label="Selecione" onchange="PF('monografiaTable').filter()"
converter="omnifaces.SelectItemsConverter">
<f:selectItems
value="#{gestaoMonografiasBean.listaLinhaPesquisas}"
var="listaLinhaPesquisas"
itemLabel="#{listaLinhaPesquisas.nome}"
itemValue="#{listaLinhaPesquisas}"/>
</p:selectCheckboxMenu>
</f:facet>
<h:outputText value="#{monografia.listaLinhaPesquisas[0].nome}" />
</p:column>
Thanks for the help. But as I leave to show dynamically, as this column can receive both an attribute and several
– Daniel Azevedo
In this case you can do the following: 1 - Build a String that has all the names you want to display when you are in read mode 2 - Use something like a Selectmanymenu with the items already selected when you are in edit mode.
– prmottajr
You made me open my head to something else I had researched and hadn’t been able to apply, which was Datalist. I used Datalist and solved my problem, thanks for the help.
– Daniel Azevedo
@Danielazevedo good that solved. If the answer helped can accept it, it helps who answers :)
– prmottajr