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

Compatibility package: rows inserted in grid are blank if selected #11477

Closed
alessandroguarascio opened this issue Mar 1, 2019 · 2 comments · Fixed by #11501
Closed

Compatibility package: rows inserted in grid are blank if selected #11477

alessandroguarascio opened this issue Mar 1, 2019 · 2 comments · Fixed by #11501
Labels
BFP bug workaround Workaround provided in ticket comments
Milestone

Comments

@alessandroguarascio
Copy link

alessandroguarascio commented Mar 1, 2019

On Vaadin 8.7.0 (compatibility mode) when adding an item into an IndexedContainer bound to a Grid the corresponding row is displayed as blank in grid and it is not selectable. This problem occurs only if:

  • the method {{container.addItemAt(...)}} is used,
  • the index of the added item is greater than the currently selected row,
  • the new row is programmatically selected immediately after insertion..

This used to work in Vaadin 7.x

Attached there is a sample UI MyUI.zip showing this problem

@anasmi
Copy link
Contributor

anasmi commented Mar 8, 2019

Hi,

I've been trying to locate today when problem occurred first, but didn't manage to find the place. I checked that both 8.1 and 8.6 with compatibility packages have the issue already, so most likely the problem was introduced from the beginning of compatibility package.

My best guess at this point, that when you are trying to select the row, which was just added, the client side is not aware, it exists. Since adding the row without selecting works jut fine. (So the container has item on server side, but grid is not aware of that on client)

The workaround for the issue is to delay the selecting of the row. This worked for me:

Class variable: 
 final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(
            1);
///
from Button Listener:
executor.schedule(() -> getUI().access(()->{
                selectOnlyLastItemIfRequested(checkBox);
                currInsertionIndex++;
            }), 100, TimeUnit.MILLISECONDS);
        });

That's not a proper solution, but a workaround. Someone will have to look closer into the problem, to investigate it further. I hope you can use the code above in meanwhile (It needs push through)
Verified: worked in 7.7.16

@TatuLund TatuLund added the workaround Workaround provided in ticket comments label Mar 8, 2019
@alessandroguarascio
Copy link
Author

Thank you for the workaround,

Unfortunately this requires push to be enabled (several legacy infrastructures do not allow websockets, neither long polling calls) and, in addition, is not always working with a delay of 100ms.

With a longer delay it seems to be more reliable but longer lags introduce some noticeable sluggishnesh in the UI compromising the general User Experience.

Klaudeta added a commit to Klaudeta/framework that referenced this issue Mar 19, 2019
pleku pushed a commit that referenced this issue Mar 21, 2019
Make improve of caching for hierarchical data optional

Fixes #11477
ZheSun88 pushed a commit that referenced this issue Apr 2, 2019
Make improve of caching for hierarchical data optional

Fixes #11477
pleku pushed a commit that referenced this issue Apr 2, 2019
Make improve of caching for hierarchical data optional

Fixes #11477
@ZheSun88 ZheSun88 added this to the 8.7.2 milestone Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFP bug workaround Workaround provided in ticket comments
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants