I am pretty new to jsf and primefaces I am using data table with ajax but the serach is not working in it.
The search works fine without ajax, so please can anyone suggest me what the problem can be with ajax filtering.
Code: Select all
<f:view>
<h:form>
<!--<p:dataTable var="a" value="#{student.getStudents()}" paginator="true" rows="10" lazy="true" id="tbl" emptyMessage="Sorry there are no data available" loadingMessage="Please Wait">-->
<p:dataTable dynamic="true" var="a" value="#{tablebean.lazyModel}" paginator="true" rows="10" lazy="true" id="tbl" emptyMessage="Sorry there are no data available" loadingMessage="Please Wait">
<p:column filterBy="#{a.model}">
<f:facet id="model" name="header">
<h:outputText value="Model" />
</f:facet>
<h:outputText value="#{a.model}" />
</p:column>
<p:column filterBy="#{a.year}">
<f:facet name="header" >
<h:outputText value="Year" />
</f:facet>
<h:outputText value="#{a.year}" />
</p:column>
<p:column filterBy="#{a.manufacturer}">
<f:facet name="header">
<h:outputText value="Manufacturer" />
</f:facet>
<h:outputText value="#{a.manufacturer}" />
</p:column>
<p:column filterBy="#{a.color}">
<f:facet name="header">
<h:outputText value="Color" />
</f:facet>
<h:outputText value="#{a.color}" />
</p:column>
</p:dataTable>
<h:panelGrid columns="2">
<p:panel header="Export All Data">
<h:commandLink>
<p:graphicImage value="images/excel.png" />
<p:dataExporter type="xls" target="tbl" fileName="cars" />
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/pdf.png" />
<p:dataExporter type="pdf" target="tbl" fileName="cars"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/csv.png" />
<p:dataExporter type="csv" target="tbl" fileName="cars" />
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/xml.png" />
<p:dataExporter type="xml" target="tbl" fileName="cars" />
</h:commandLink>
</p:panel>
<p:panel header="Export Page Data">
<h:commandLink>
<p:graphicImage value="images/excel.png" />
<p:dataExporter type="xls" target="tbl" fileName="cars" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/pdf.png" />
<p:dataExporter type="pdf" target="tbl" fileName="cars" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/csv.png" />
<p:dataExporter type="csv" target="tbl" fileName="cars" pageOnly="true"/>
</h:commandLink>
<h:commandLink>
<p:graphicImage value="images/xml.png" />
<p:dataExporter type="xml" target="tbl" fileName="cars" pageOnly="true"/>
</h:commandLink>
</p:panel>
</h:panelGrid>
</h:form>
</f:view>