Book Image

Vaadin 7 Cookbook

Book Image

Vaadin 7 Cookbook

Overview of this book

Table of Contents (19 chapters)
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Filtering data in the table


When we want to filter data in the table, we have to bind this table with the container that implements the Container.Filterable interface. With this kind of container, we can filter the rows, for example, by strings or by numbers. Vaadin provides several built-in filters. Some of them are described in the There's more… section at the end of this recipe. Values may be equal, or may be greater, smaller, or may contain a part of the substring. We can also create our own filter. In this recipe, we will create a simple table with custom filter. We will filter two values by string and ID value by the greater one. Our filter will be placed on the top of the table as shown in the following screenshot:

How to do it...

Carry out the following steps to create a table with filter:

  1. Create a Vaadin project with a topmost class called Demo.

    public class Demo extends UI {…}
  2. First, we need a Product bean. It's the same bean as used in the Binding a container to a component recipe...