Filter and sort a column simultaneously

Is it possible to combine the grid sorting and grid filtering per column?

I dont get it to work.
If it is possible can you share an example?

Maybe my question could be a little broader. Is it possible to combine all different grid column types that vaadin has to offer. Like sort, filter, edit, tree etc?



In the examples of the grid, you have a simple demo of how to filter a grid:

I think you can combine this example with the sort functionality.

Hi Jan

I have written about grid filter for each column in [this SO answer]
(, I really recommend reading that for the filtering part.

This can be combined with sorting, all you need to do for that is to define a Comparator for each column that doesn’t automatically have sorting yet. Please be aware that most columns created with a property name (i.e. addColumn("name")) have already comparators.

Since I have trouble finding code examples for setting comparators of grid columns, here is my example for doing that.

Grid<Person> grid = new Grid(Person.class, false);
grid.addColumn(item -> item.getName())