Problem with clearing and selecting rows in a hidden grid

For the Polymer Element version of vaadin-grid, we have found a problem with clearing selections and setting selections when the grid is hidden (display:none). Our hidden grid is in multi-select mode.

I have attached the HTML file that I was using to show the problem, and a screenshot of the browser display. Here are the steps to reproduce the problem:

  • Click on a row in the Logical Name grid. The corresponding row in the Role grid will be selected (checked). Click on a few different rows to see how this works.
  • Now, deselect the currently selected row in the Logical Name grid. The corresponding row in the Role grid will also be unchecked.
  • Click the “Hide Grid” button to hide the Role grid.
  • Select a different row in the Logical Name grid.
  • Click the “Show Grid” button to show the Role grid. No rows are selected (no checked checkboxes).
  • Now, in the Role grid, click on a checkbox for a different row. You will now see 2 checked checkboxes – the one that you just checked and the “missing” one.
  • Another option is to select all the rows in the Role grid, using the header checkbox. Hide the grid. Select a different row in the Logical Name grid. Show the grid. Most of the checkboxes are still checked.

28706.png
28707.html (2.04 KB)

I uploaded the sample HTML to this address where you can actually run it:
http://plnkr.co/edit/HWFgTNYPZyLN3DjvdLqi?p=preview
.

I also noticed that there seems to be a related open issue mentioned in the github at:
https://github.com/vaadin/vaadin-grid/issues/335
.

Seems to be a bug alright. I tagged it as a bug in github and referenced this forum post.

But as a workaround, you can use grid.refreshItems() and grid._grid.updateSize() as Sauli suggested in the github issue.

Yes, we are using a similar workaround. In our specific case, the “hidden” grid resides in a paper-dialog. We refresh the grid when we get the iron-overlay-opened event. So, we can get around the bug right now, but we might not be able to, easily, in some future use-case.

Thanks for the reply.