• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Search Datatable , filter the records & display data

Ranch Hand
Posts: 99
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
I'm not sure if I approve of this interruption. But this tiny ad checks out:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic