I'm trying to migrate an application from RichFaces to PrimeFaces 10.0. As part of it, there is a search link which when clicked performs the actions method returns a list of cars populated by a p:dataTable
. The data table is rendered if the command link is h:commandLink
but is not rendered if replaced with p:commandLink
. Is there any additional tag that needs to be added to the p:commandLink
for the table to be rendered?
<h:form id="example">
<h:panelGrid columns="3" id="searchId">
<h:commandLink id = "cmdd" value="Search" action="#{carBean.searchCars}"/>
</h:panelGrid>
<h:panelGrid id="panelGroup" style="width:100%" styleClass="tblNowrap100pct">
<p:dataTable value="#{carBean.carList}" var="car" id="carTbl"
stripedRows="true" rendered="#{not empty carBean.carList}"
showGridlines="true" styleClass="tblNowrap100pct"
filteredValue="#{carBean.filteredValues}" rowKey="#{car.carId}">
<p:column headerText="Car Name" sortBy="#{car.carName}" filterBy="#{car.carName}" filterMatchMode="contains" >
<f:facet name="header">
<h:outputText value="Car Name" />
</f:facet>
<h:outputText value="#{car.carName}" />
</p:column>
<p:column headerText="Make" sortBy="#{car.make}" filterBy="#{car.make}" filterMatchMode="contains">
<f:facet name="header">
<h:outputText value="Make" />
</f:facet>
<h:outputText value="#{car.make}" />
</p:column>
</p:datatable>
</h:form>
The above code does not render the data table when replaced with p:commandLink
. When replacing with p:commandLink
the action method is invoked and the list is populated but is not getting rendered in the xhtml page.
public void searchCars() {
try {
this.carList = carService.searchAllCars(this.carDto);
if (carList.isEmpty()){
FacesMessage message = new FacesMessage("No records found.");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, message);
}
}
catch(Throwable exception){
...
}
}
*Edited to added a couple of columns to the datatable which is not rendered if the commandlink is a primefaces command link