1

I am trying to apply filter on my datatable but i don't why it is not working.I have checked all the things again and again but still it is not working and even not showing any error or exception.Here is my code
page.xhtml

<p:dataTable id="masterResult" value="#{masterSearch.masterSearchResultList}" var="srvc" 
                             styleClass="display" style="cursor:pointer;" rows="6" 
                             paginator="true" rowsPerPageTemplate="5,10,15" paginatorAlwaysVisible="false" paginatorPosition="bottom"
                             widgetVar="viewTable" filteredValue="#{masterSearch.filterMasterSearchResult}">
                                
                                <p:column filterBy="#{srvc.serviceNumber}"  
                                                headerText="Service Number"
                                                filterMatchMode="endsWith">  
                                        <h:outputText value="#{srvc.serviceNumber}"/>  
                                </p:column>
                                
                                <p:column headerText="Rank">
                                #{srvc.rank}
                                </p:column>
                                
                                <p:column headerText="Name">
                                #{srvc.name}
                                </p:column>
                                         
                                <p:column headerText="Course">
                                #{srvc.course}
                                </p:column>
                                         
                                <p:column headerText="Unit">
                                #{srvc.unit}
                                </p:column>
                                         
                                <p:column headerText="Relation">
                                #{srvc.relation}
                                </p:column>
                            </p:dataTable>

Here I am getting the values properly but when I write anthing in filter text field (showed by primefaces)it won't work.
Please help if anyone get idea about this
Thanks

Edit:

public class MasterSearch {
    
    String serviceNumber;
    String rank;
    String fullName;
    String CNICNumber;
    String phoneNumber;
    String emailAddress;
    List<MasterSearchResult> masterSearchResultList;
    List<MasterSearchResult> filterMasterSearchResult;

               // getter 
               //  setters

1 Answer 1

2

Remove this part : filteredValue="#{masterSearch.filterMasterSearchResult}"

check my sample from here : https://dl.dropbox.com/s/v3ihl25aozt8qyn/mavenproject.zip?dl=1

10
  • yes it is srvc.serviceNumber.I pasted old code mistakenly but now i edited in my question.I have pasted my bean please chk
    – khan
    Aug 30, 2012 at 8:17
  • Please check with filterMatchMode="contains".
    – Mehdi
    Aug 30, 2012 at 8:23
  • yes I checked it with "contains" , "startsWith" , "exact" but it is not working
    – khan
    Aug 30, 2012 at 10:10
  • which version of primefaces do you use? could you please upload the code somewhere then I will check the code!
    – Mehdi
    Aug 30, 2012 at 10:56
  • code is actually so large so i didn't paste it here.Which part do you want to see in code? i will paste that part.I am using the latest version of primefaces which is primefaces-3.4.RC1.jar
    – khan
    Aug 30, 2012 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.