1

I'm trying on button click show up selected row of a datatable. I'm using tag rendered to show/hide this button, but it is rendered only when the page is reloaded. For this reason I want that when I selected row, the page is reloaded and tag rendered is executed again.

Function conv return a boolean value, depending of if button should show up or not.

Any idea how to do it?

<p:dataTable id="singleDT" var="inform" value="#{testBean.searchInform}" selectionMode="single" selection="#{testBean.selectedInform}" rowKey={inform.id}">
    <f:facet name="header">
        Single with Row Click
    </f:facet>
    <p:column headerText="Id">
        <h:outputText value="#{inform.id}" />
    </p:column>
    <p:column headerText="Year">
        <h:outputText value="#{inform.year}" />
    </p:column>
    <p:column headerText="Brand">
        <h:outputText value="#{inform.brand}" />
    </p:column>
    <p:column headerText="Color">
        <h:outputText value="#{inform.color}" />
    </p:column>
    <f:facet name="footer">
        <p:commandButton for="singleDT" process="singleDT" update=":form:informeDetail" icon="ui-icon-search" value="Convert" action="#{testBean.Convert}" rendered="#{testBean.conv}"/>
    </f:facet>
</p:dataTable>
Vasil Lukach
  • 3,658
  • 3
  • 31
  • 40
JM39370
  • 31
  • 3

1 Answers1

0

When rendered is false the HTML document will not contain the given component, thus it cannot refresh it.

You should place your <p:commandButton> inside another JSF component, and rerender that enclosing component instead.

Usagi Miyamoto
  • 6,196
  • 1
  • 19
  • 33