Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Show/Hide HeaderRow of Grid
I want to give the user the opportunity to filter data in a grid. So I added a new HeaderRow to the grid and placed TextFields inside of every cell in the HeaderRow.
HeaderRow filterRow = grid.appendHeaderRow(); HeaderCell cell = filterRow.getCell("id"); TextField filterField = new TextField(); cell.setComponent(filterField);
Now I want to make this row hideable, so that the TextFields are not always visible, but only if the user wants to filter something. What would be the best way to do this?
As far as I know, it is only possible to hide the whole header of the grid, but I just want to hide this one row.
Have you checked Grid.removeHeaderRow(Grid.HeaderRow row) method?
Hi Tatu Lund,
thanks for your hint. I already used that method before, but the big disadvantage for me is, that I will have to build the whole row again and again.
So if I call
Later, I have to call
HeaderRow row = Grid.appendHeaderRow();
again and have to initialize all TextFields again. I thought, there would be a much simplier way to do it. :)
Yes, unfortunatelly that is true. However actually building the row is not very resource consuming. But I agree that in this specific case it would be nice if you could give the readily made row as a parameter to appendHeaderRow.
I am also interested in this fucntionality, but I guess I will have to rebuild the HeaderRow for now :(
Any news on this? I need to hide my filter row too. :)