Grid Helpers Add-on
Several grid recipes for Vaadin 23+ (and 22), ready to use
Several grid recipes for Vaadin 23+ (and 22), ready to use. DOES NOT require extending Grid.
Features
- Remove multiselect selection column
- Freeze a grid's selection (checkbox) column
- Create Grid with conditional selection (with the following limitations: #11, #12)
- Select Grid rows automatically using up/down arrow keys
- Show a Vaadin Grid with compact row styling
- Show a meaningful message instead of an empty Grid
- Show a menu to toggle the visibility of grid columns
Sample code
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.MULTI); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(Person::getTitle).setHeader("Title"); grid.addColumn(Person::getCountry).setHeader("Country"); grid.addColumn(Person::getCity).setHeader("City"); grid.addColumn(Person::getStreetAddress).setHeader("Street Address"); grid.addColumn(Person::getPhoneNumber).setHeader("Phone Number"); grid.getColumns().forEach(c -> c.setAutoWidth(true)); GridHelper.setSelectionColumnFrozen(grid, true);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.MULTI); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(Person::getCountry).setHeader("Country"); GridHelper.setSelectionColumnHidden(grid, true);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.MULTI); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(p -> p.isActive() ? "Yes" : "No").setHeader("Active"); GridHelper.setSelectionFilter(grid, Person::isActive);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.MULTI); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(Person::getCountry).setHeader("Country"); GridHelper.setSelectOnClick(grid, true);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.SINGLE); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(Person::getCountry).setHeader("Country"); GridHelper.setArrowSelectionEnabled(grid, true);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); grid.setSelectionMode(SelectionMode.SINGLE); grid.addColumn(Person::getFirstName).setHeader("First name"); grid.addColumn(Person::getLastName).setHeader("Last name"); grid.addColumn(Person::getCountry).setHeader("Country"); grid.addThemeName(GridHelper.DENSE_THEME);
Grid<Person> grid = new Grid<>(); grid.setItems(TestData.initializeData()); Column<Person> firstNameColumn = grid.addColumn(Person::getFirstName).setHeader("First name"); Column<Person> lastNameColumn = grid.addColumn(Person::getLastName).setHeader("Last name"); Column<Person> countryColumn = grid.addColumn(Person::getCountry).setHeader("Country"); GridHelper.setHidingToggleCaption(firstNameColumn, "First name"); GridHelper.setHidingToggleCaption(lastNameColumn, "Last name"); GridHelper.setHidingToggleCaption(countryColumn, "Country"); GridHelper.setColumnToggleVisible(grid, isVisible());
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Bug fixes:
- Released
- 2024-01-29
- Maturity
- TESTED
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 23
- Vaadin 24
- Vaadin 22 in 0.1.0
- Browser
- N/A
Grid Helpers Add-on - Vaadin Add-on Directory
Several grid recipes for Vaadin 23+ (and 22), ready to useSeveral grid recipes for Vaadin 23+ (and 22), ready to use. DOES NOT require extending Grid.
### Features
* Remove multiselect selection column
* Freeze a grid's selection (checkbox) column
* Create Grid with conditional selection (with the following limitations: [#11](https://github.com/FlowingCode/GridHelpers/issues/11), [#12](https://github.com/FlowingCode/GridHelpers/issues/12))
* Select Grid rows automatically using up/down arrow keys
* Show a Vaadin Grid with compact row styling
* Show a meaningful message instead of an empty Grid
* Show a menu to toggle the visibility of grid columns