Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message is not visible inside of vaadin-grid #788

Closed
javier-godoy opened this issue Jan 26, 2021 · 3 comments · Fixed by vaadin/vaadin-text-field#570
Closed

Error message is not visible inside of vaadin-grid #788

javier-godoy opened this issue Jan 26, 2021 · 3 comments · Fixed by vaadin/vaadin-text-field#570
Assignees
Labels
BFP Bug fix prioritised by a customer bug Something isn't working Impact: High Severity: Minor

Comments

@javier-godoy
Copy link

javier-godoy commented Jan 26, 2021

Description

[Vaadin 14.4.4] The error message of DatePicker is not visible when the component is used inside of vaadin-grid (but other components such as vaadin-text-field, vaadin-integer-field, etc) are able to display the error message.

Expected outcome

image

Actual outcome

image

Steps to reproduce

Grid<Entity> grid = new Grid<>();
grid.addColumn(Entity::getId).setHeader("Double click to edit");
add(grid);
		
IntegerField iField = new IntegerField();
DatePicker dField = new DatePicker();
grid.addColumn(Entity::getAmount).setEditorComponent(iField).setHeader("A positive number");
grid.addColumn(Entity::getDate).setEditorComponent(dField).setHeader("A date in the past");
grid.setItems(new Entity(1), new Entity(2));
		
Binder<Entity> binder = new Binder<>();
binder.forField(dField).withValidator(d->d.compareTo(LocalDate.now())<=0,"Error!").bind(Entity::getDate, Entity::setDate);
binder.forField(iField).withValidator(i->i>0,"Error!").bind(Entity::getAmount, Entity::setAmount);
grid.getEditor().setBinder(binder);
		
grid.addItemDoubleClickListener(ev->{
	grid.getEditor().editItem(ev.getItem());
});
@tomivirkki tomivirkki added the BFP Bug fix prioritised by a customer label Jan 27, 2021
@tomivirkki
Copy link
Member

Workaround:

binder.addStatusChangeListener(e -> {
    grid.getElement().executeJs("setTimeout(function() {$0.notifyResize()}, 300);", grid.getElement());
});

The proper fix is to make the text field dispatch an iron-resize event once the size increase animation has finished

@web-padawan
Copy link
Member

The proper fix is to make the text field dispatch an iron-resize event once the size increase animation has finished

Should this be a feature supported by all field components intended to be used in Grid editor?

@tomivirkki
Copy link
Member

tomivirkki commented Jan 27, 2021

Should this be a feature supported by all field components intended to be used in Grid editor?

Grid editor is just one use-case where this is relevant. Generally, all components whose size changes dynamically should dispatch an iron-resize event to notify a parent component, that might be listening for it. We might want to change the event name to vaadin-resize for the next generation components (or craft a more modern solution with ResizeObserver).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFP Bug fix prioritised by a customer bug Something isn't working Impact: High Severity: Minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants