vaadin/src/main/java/net/typedrest/vaadin/GridUtils.java
public static void addFilterRow(Grid grid) {
        if (grid.getHeaderRowCount() < 2) {
            grid.appendHeaderRow();
        }
        Grid.HeaderRow headerRow = grid.getHeaderRow(1);

        Container.Indexed container = grid.getContainerDataSource();
        container.getContainerPropertyIds().forEach(pid -> {
            TextField filterField = new TextField();
            filterField.setInputPrompt("Filter");
            filterField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
            filterField.setWidth(100, Sizeable.Unit.PERCENTAGE);
            filterField.addTextChangeListener(event -> {
                ((Container.SimpleFilterable) container).removeContainerFilters(pid);
                if (!event.getText().isEmpty()) {
                    ((Container.Filterable) container).addContainerFilter(new SimpleStringFilter(pid, event.getText(), true, false));
                }
            });
            headerRow.getCell(pid).setComponent(filterField);
        });
    }
public static void addFilterRow(Grid grid) {
        if (grid.getHeaderRowCount() < 2) {
            grid.appendHeaderRow();
        }
        Grid.HeaderRow headerRow = grid.getHeaderRow(1);

        Container.Indexed container = grid.getContainerDataSource();
        container.getContainerPropertyIds().forEach(pid -> {
            TextField filterField = new TextField();
            filterField.setInputPrompt("Filter");
            filterField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
            filterField.setWidth(100, Sizeable.Unit.PERCENTAGE);
            filterField.addTextChangeListener(event -> {
                ((Container.SimpleFilterable) container).removeContainerFilters(pid);
                if (!event.getText().isEmpty()) {
                    ((Container.Filterable) container).addContainerFilter(new SimpleStringFilter(pid, event.getText(), true, false));
                }
            });
            headerRow.getCell(pid).setComponent(filterField);
        });
    }
Adds a row of filter text boxes to a Vaadin {@link Grid}.

@param grid The grid to add the filter row to.