(TypeError) : Cannot read property 'doDeselector' of undefined - Vaadin 10.

Has anyone encountered an error message like this, “(TypeError) : Cannot read property ‘doDeselector’ of undefined”?

I have a grid as a component of a dialog. The grid has the multi select enabled. When the dialog is displayed with one or more of the grid rows selected and then the dialog is closed and displayed a second time, the error occurs. If the 1st display of the dialog does not have any grid rows selected and then the dialog is closed and displayed a second time, the error does not occur.

Seems like when loading the grid a second (or more times), the sever side is trying to deselect any selected rows on a browser side grid component that is not longer there.

		final List<SalesPerson> listOfSalesPerson = salesGroupPresenter.getAllSalesPersons();
		membersGrid.setItems( listOfSalesPerson );

Update:
The same thing happens with the latest release of Vaadin 13 (13.0.1).

I’m struggling with the same problem. Any situation where a grid has a selected row, and is removed from current view, and then is shown again, the message appears. Currently using Vaadin 13.0.1, but also happened on every Flow version I’ve tried.

If we cant avoid this message, is there any way to set timeout for it ?

The problem for me is, that after this error occurred (after re-using a grid which had a selected item), context menu is not working anymore.
This problem still exists in 13.0.5

The exception occour in the file vaadin-grid-flow-selection-column.html

The follow function call the doSelection, but the $connector has no such function.

  _onSelectClick(e) {
    e.target.checked ? this._grid.$connector.doDeselection(e.model.item, true) : this._grid.$connector.doSelection(e.model.item, true);
    e.target.checked = !e.target.checked;
  }

The problem is still in version 13.0.10.

Can anyone from Vaadin confirm the fix will be in the next V13 release?

Thanks.

I am facing the same issue in Vaadin 13.0.8.

Thanks.

As described earlier in the post, the problem occurs when a row / rows are selected. In my case I switch between two SingleSelect grids that display different objects. I used singleSelect.setValue(null) to prevent the error. This might not suit your case, but this is how I solved the problem.

SingleSelect<Grid<Object>, Object> objectSelect = grid.asSingleSelect();
...
// Canceling the selection of any grid items
objectSelect.setValue(null);
layout.remove(grid);

So basically every time I remove the grid, I also remove any (old) selections. I guess you could probably do this before adding it back again too. Hope this helps.

I used dataGrid.getDataProvider().refreshAll() to prevent the error.

Can someone please expand on the workaround because I don’t fully understand how the above snippets resolve the error. Thank you.

Is there a GitHub issue with a reproducible example yet?

Yes you can. https://github.com/vaadin/vaadin-grid-flow/issues/706

Vasily Menshev:
I used dataGrid.getDataProvider().refreshAll() to prevent the error.

Hi Vasily,

where did you put the dataGrid.getDataProvider().refreshAll()?

Hi Jet!

Like that

private void setGridData() {
        dataGrid1.getDataProvider().refreshAll();
        ListDataProvider<ListData> listDataProvider = new ListDataProvider<>(items);
        dataGrid1.setDataProvider(listDataProvider);
}

Vasily Menshev:
Hi Jet!

Like that

private void setGridData() {
        dataGrid1.getDataProvider().refreshAll();
        ListDataProvider<ListData> listDataProvider = new ListDataProvider<>(items);
        dataGrid1.setDataProvider(listDataProvider);
}

Hi Vasily,

Thanks for the quick reply. I will try that,

Vasily Menshev:
Hi Jet!

Like that

private void setGridData() {
        dataGrid1.getDataProvider().refreshAll();
        ListDataProvider<ListData> listDataProvider = new ListDataProvider<>(items);
        dataGrid1.setDataProvider(listDataProvider);
}

Hi Vasily, it works… Thank you.