Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Filtering tables


Filtering data is a very useful facility in a table. It allows the user to see only the set of data that matches a certain set of rules (criteria); most commonly, filter by column(s). For example, the user may need to see all players younger than 26 years, which is a filter applied in the column labeled Age.

Basically, a filter can have only visual effect, without modifying the filtered data (using some CSS, JS code, or duplicating the filter results in a separate collection and displaying that collection), or by removing the unnecessary items for the initial collection (which requires restoring its content when the filter is removed).

In JSF, we can write a nice filter by playing with some CSS code, which can be used to hide/show rows of a table; this is not a recommended approach in production, since all the data is still available in the source page, but it might be useful when you don't need anything fancy. The idea is to hide all of the table's rows that do not match...