-
Notifications
You must be signed in to change notification settings - Fork 83
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
Tab key press not committing editing component updates to the row model #7108
Comments
Your implementation slightly differs from the example of using Binder with GridPro here https://cookbook.vaadin.com/grid-pro-binder Notably, you should call setBean every time editor is being opened and also reset the Binder when edit is ended. See the listeners. Furthermore as you use Binder, you do not need to call setter in the update call back as Binder already commits the value to the bean ".custom(value4Field, (row, newValue) -> row.setValue4(newValue))" |
I've updated the example and added the missing combo box column that was one of the issues. If you go to he combo and open it and arrow down to a selection and then tab to the next column the combo value is not updated in the grid but if you arrow or click back into the editor the value is displayed and then when you depart the field it updates and shows in the grid.
|
This is a very odd edge case, there seems to be timing glitch. Noting here, that this Binder setup is not officially supported, it is just a Recipe I wrote as I found it mostly works, naturally I did not test ComboBox. But it is possible to get the ComboBox working as well. You need to do two modifications to your code. Add refreshing of the Grid item after ComboBox value has changed. Normally GridPro does refreshing of the item by itself, but seems to happen too early.
The other change is the property change listener, which removes the bound bean. You need to either remove it fully or change the setBean(null) call to happen after client roundtrip. Purpose of this call is to prevent showing the old field values when the editor opened next time, which may happen if the network latency is long enough.
|
When I apply these changes to my production code the combo box add change listener refresh fails because the binder.getBean() is returning a null value. You've referenced a couple times that the provided cookbook solution and the way we are using the binder is non-standard or not a supported usage. What do you mean by that? |
Then there is another type of timing glitch in your application. I.e. value change is triggered later, and the binder.setBean(null) has been already executed. Then I would remove that part as apparently not needed in your case.
GridPro has not been designed this in mind, as you have observed there are various potential edge cases and pitfalls as timings can go this way or other way. So in order to make it work, it requires some tinkering. I think there should be a ticket about adding Binder support in GridPro, but I can't find it now. |
Nope. This is not resolved. It is still glitching and acting flaky. I was hoping that full Binder support was something that you'd be looking into. |
This probably should be considered as an enhancement request to officially support |
The issue with Tab key press be fixed by #7822 for both ComboBox and DatePicker. |
@TatuLund This fix pulled into the 23.5.8 release seems to be working well for us in our initial testing. 😃 Thanks! |
Description
When the user makes edits in the edit components the values are changed and stored only in the edit controls when the user presses the tab key to depart the edit component. When the user uses the space key or the enter key the edit controls and the row model are synced up just like normal. When using the tab key the prior row model's data is restored in the row for display to the user. When the user comes back to the edit component the updated edit value the user entered is displayed again.
Expected outcome
I would expect the edits to the DatePicker and ComboBox components to be applied to the row model and vice versa as appropriate when the tab key is pressed rather than the space or enter key.
Minimal reproducible example
package com.ciminc;
import java.time.LocalDate;
public class RowObject {
}
package com.ciminc;
import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.gridpro.GridPro;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.router.Route;
import java.util.ArrayList;
import java.util.List;
@route
public class MainView extends VerticalLayout {
}
Steps to reproduce
Setup a grid with edit controls per normal with TextField and ComboBox and DatePicker components.
Add/edit a row.
Use tab to depart fields and see space/enter committed data in the row but not tab committed data
Environment
Vaadin version(s): 23.3.30
OS: Ubuntu 22.04.3 LTS
Component: GridPro
Browsers
Chrome, Firefox
The text was updated successfully, but these errors were encountered: