Make element visible on ajax in JSF2

Posted by amorfis on Stack Overflow See other posts from Stack Overflow or by amorfis
Published on 2010-05-08T08:21:48Z Indexed on 2010/05/08 8:28 UTC
Read the original article Hit count: 281

Filed under:
|

I have dataTable in my page. Initially I want it to be hidden, and show after fetching data by AJAX request. I know how to fetch data and put into table, but I don't know how to show table if it is hidden. Here is the code:

<h:commandButton value="aa">
  <f:ajax execute="from to validTo" render="transportOffers"/>
</h:commandButton>
<p:dataTable id="transportOffers" value="${cargoOffer.transportsForCargo}" var="transport">
  <p:column>
    <h:outputText value="${transport.company}"/>
  </p:column>
</p:dataTable>

Table is visible initially, even if it is empty. If I set rendered="false" it is invisible, and remains invisible also after AJAX request.

How can I make it hidden initially, and to show up after populating with data?

© Stack Overflow or respective owner

Related posts about jsf2

Related posts about AJAX