• Post Reply Bookmark Topic Watch Topic
  • New Topic

Search Datatable , filter the records & display data  RSS feed

Varshini Priya
Ranch Hand
Posts: 95
Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a requirement of implementing Search and Filter over a datatable. The datatable I am using has around 20 columns .

The requirement goes as, there would be a input text box for writing the searchable record and a drop-down menu beside it which will take the column names as its values.There is a criteria dropdown, which contains values like(=,<,>,<=,>=,"Between","Like").These drop-downs will act a filter.

The user would select the column from the drop down where it has to be searched and select the corresponding criteria as well and type a value that needs to be searched and click Search button. If found then the row corresponding to where the record exist is displayed in the datatable and if not then "No records found" will be displayed. Again the Search will not retrieve records from the database, but only the records which are presesnt in the memory based on which the datatable is formed.

Please provide me suggestions as how to proceed. Im using JSF 2.0 & for the datatable, Im using Primefaces 3.2. Im aware that primefaces has similar attributes in the <p:column> component . But I wanted this search/filter option to exists outside the datatable as a seperate component. Please find the snapshot of the search that im trying to acheive. The process that I have followed is specified below

1. Im actually invoking a service to populate the datatable for the first time. Im getting the data as a list. This list, Im converting it to a Hashmap.
2. In the Hashmap, the Key will be the column name and the value will be the List of all the values corresponding to that particular column.
3. Im doing a search on this hashmap for the user entered values. But Im not sure how to get the row id corresponding to that column and display the entire column data in the Datatable.

Please Help me and provide some suggestions that I can follow to acheive the same.

Thanks in Advance

[Thumbnail for filterSelect.png]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!