Directory

← Back

Enhanced Grid

This component is an extended version of Grid with integrated complex filtering and other features

Author

Rating

Popularity

400+

This component is an extended version of Grid to add support to the following features:

Features

set a predicate to indicate which rows/items can be selected

EnhancedGrid#setSelectionPredicate(SerializablePredicate)

set a predicate to indicate which rows/items can be edited

EnhancedGrid#setEditablePredicate(SerializablePredicate)

check if a item is editable

EnhancedGrid#isEditable(T)

edit an item and cancel the edit

EnhancedGrid#editItem(T)
EnhancedGrid#cancelEdit()

set a flag to indicate if a cancel edit confirmation dialog should be display if user navigates away from current editing row

EnhancedGrid#setShowCancelEditDialog(boolean)

Each column can define a filter field/dialog through

EnhancedColumn#setHeader(String, HasValueAndElement)
EnhancedColumn#setHeader(Component, HasValueAndElement)

Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: Support and Pricing

Sample code

// create grid
EnhancedGrid<Person> grid = new EnhancedGrid<>();

// set selection predicate to indicate which items can be selected
grid.setSelectionPredicate(p -> p.getAge() > 18);

// set items
grid.setItems(personService.fetchAll());

// add columns
// first name column with filtering button on header
EnhancedColumn<Person> firstNameColumn = grid.addColumn(Person::getFirstName).setHeader("First Name", new TextFilterField());
// last name column with filtering button and pre-selected filter by last name = "Allen"
grid.addColumn(Person::getLastName).setHeader("Last Name", new TextFilterField(new TextFieldFilterDto("Allen")));
// age column with renderer
NumberRenderer<Person> ageRenderer = new NumberRenderer<Person>(Person::getAge, "Age: %d");
EnhancedColumn<Person> ageColumn = grid.addColumn(ageRenderer, PersonSort.AGE).setHeader("Age", new TextFilterField());
ageColumn.setValueProvider(p -> String.valueOf(p.getAge()));

// add pre-selected descendent order for first name column
List<GridSortOrder<Person>> sortByFirstName = new GridSortOrderBuilder<Person>()
	  .thenDesc(firstNameColumn).build();
grid.sort(sortByFirstName);

// set selection mode
grid.setSelectionMode(Grid.SelectionMode.SINGLE);

// can pre-select items
grid.select(personList.get(0));
	   
// set editable predicate to indicate which items can be edited
grid.setEditablePredicate(p -> p.getAge() > 18);        

// add binder and editor for grid
Binder<Person> binder = new Binder<>(Person.class);
Editor<Person> editor = grid.getEditor();
editor.setBinder(binder);
editor.setBuffered(true);
 
// define editor components for columns
TextField firstNameField = new TextField();
binder.bind(firstNameField, Person::getFirstName, Person::setFirstName);
firstNameColumn.setEditorComponent(firstNameField);
	   
// call edit
grid.addItemDoubleClickListener(event -> {
	grid.editItem(event.getItem());
	firstNameField.focus();
});
        

Compatibility

(Loading compatibility data...)

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:

  • Update columns headers on attach (#43)
Released
2024-12-12
Maturity
TESTED
License
Apache License 2.0

Compatibility

Framework
Vaadin 24.5
Vaadin 14 in 0.4.0
Vaadin 22 in 2.0.0
Vaadin 21 in 2.0.0
Vaadin 23 in 3.0.0
Vaadin 24 in 4.0.0
Browser
N/A

Enhanced Grid - Vaadin Add-on Directory

This component is an extended version of Grid with integrated complex filtering and other features Enhanced Grid - Vaadin Add-on Directory
This component is an extended version of Grid to add support to the following features: ## Features ### set a predicate to indicate which rows/items can be selected EnhancedGrid#setSelectionPredicate(SerializablePredicate) ### set a predicate to indicate which rows/items can be edited EnhancedGrid#setEditablePredicate(SerializablePredicate) ### check if a item is editable EnhancedGrid#isEditable(T) ### edit an item and cancel the edit EnhancedGrid#editItem(T) EnhancedGrid#cancelEdit() ### set a flag to indicate if a cancel edit confirmation dialog should be display if user navigates away from current editing row EnhancedGrid#setShowCancelEditDialog(boolean) ### Each column can define a filter field/dialog through EnhancedColumn#setHeader(String, HasValueAndElement) EnhancedColumn#setHeader(Component, HasValueAndElement) ### Sponsored development Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: [Support](https://vaadin.com/support) and [Pricing](https://vaadin.com/pricing)
Online Demo
View on GitHub

Enhanced Grid version 0.4.0
### Version 0.4.0 - First release for testing and feedback

Enhanced Grid version 0.5.0
### 0.5.0 - Fix to deselection event not fired - Add a way to apply filter without having to click on apply button - Other small improvements in EnhancedColumn class - Use newer Popup version

Enhanced Grid version 0.6.0
### Version 0.6.0 - Fix wrong displayed of filter & sorting buttons on header columns after refresh.

Enhanced Grid version 0.7.0
### Version 0.7.0 - Fix resizing issue by adding new enhanced-grid-sorter element to add filter button at the same level as sorting indicators - Fix filter problem when column value provider is not string based

Enhanced Grid version 0.8.0
### Version 0.8.0 - Make cancelEditItem method protected

Enhanced Grid version 0.9.0
### Version 0.9.0 - Fix issue with missing filter icon

Enhanced Grid version 0.9.1
### Bugfixes * Fix client side sorting indicator issue ([#8](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/8))

Enhanced Grid version 2.0.0
### Version 2.0.0 - Fix compatibility with Vaadin 22 and newer

Enhanced Grid version 2.0.1
### Bug fixes: * add null check on addGridSorter to avoid breaking on Vaadin 23 (fixes[#13](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/13))

Enhanced Grid version 3.0.0
Fix compatibility with Vaadin 23 ([#15](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/15)).

Enhanced Grid version 3.0.1
#### Bug fixes: * Fix ClassNameGenerator to allow to return null ([#17](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/17)) * Fix item selection on multiselection mode ([#18](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/18))

Enhanced Grid version 3.1.0
#### New features: * feat: make EnhancedColumn.getFilter public * feat: make EnhancedColumn.getValueProvider public * feat: add default theme attribute to the popup * feat: add possibility to replace filter icon

Enhanced Grid version 3.2.0
#### Bug fixes: * add support for Vaadin 23.3.x * fix EnhancedTreeGrid broken state on refresh

Enhanced Grid version 4.0.0
New version compatible with Vaadin 24.

Enhanced Grid version 4.0.1
Fixes issue with header components not being restored when using @PreserveOnRefresh

Enhanced Grid version 5.0.0
New version compatible with Vaadin 24.5. Replaces popup component with popover component.

Enhanced Grid version 5.0.1
#### Bug fixes: * Update columns headers on attach ([#43](https://github.com/vaadin-component-factory/enhanced-grid-flow/issues/43))

Online