Change whether or not item appears in <p:Datatable>

Asked

Viewed 348 times

0

Good morning. I am with the following datatable:

inserir a descrição da imagem aqui

Could you give me some insight into how I could make this Expansion appear just for the first two lines? The rest have no details to appear in the expansion.

I thought I’d use the rendered if the line is larger than 2 (or 1, I don’t know if the datatable count starts from 0 or 1). What do you think? If you think it’s a good idea, you know how I can return to the table line?

Follows XHTML

    <h:form id="form">          
        <f:metadata>    
            <f:event type="preRenderView" listener="#{cenarioBean.prepararListaFCQ}"/>    
        </f:metadata>

        <p:dataTable var="f" value="#{cenarioBean.auxFCQ}"
            paginator="false" rows="4" class="dataTable" id="dataTable" 
            emptyMessage="Nenhum Fluxo de Qualificacao Cadastrado">

            <p:column width="1">
                <p:rowToggler />
            </p:column>

            <p:columns value="#{cenarioBean.getColunas()}" var="c" headerText="#{c}" styleClass="column" width="#{c.startsWith('T') ? 200 : 60}">
                <h:outputText value="#{cenarioBean.getValorFCQ()}" />
            </p:columns>    

            <p:rowExpansion>
                Teste
            </p:rowExpansion>
        </p:dataTable>
    </h:form>

2 answers

1

Try using rendered by the column name you want Expand.

Example:

<p:rowExpansion rendered="#{c.nomeColuna == 'Coluna A' or c.nomeColuna == 'Coluna B}">
     Teste 
</p:rowExpansion>

I believe this condition solves your case.

0

The above friend option is good too, in case it is some detail I would use so if the list is not empty shows.

<p:rowExpansion rendered="#{not empty lista.lstItems}">
    Teste 
</p:rowExpansio>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.