Vaadin 24: Uncaught TypeError: Cannot read properties of undefined (reading 'doSelection')

Hi everyone. When I try to select a line in my grid I have the error message in my browser like below :

How can I fix that. Thank you in advance
image.png

can you show some code?

if (null != gridComp.getItemSelected() ) {
gridComp.getBtLink().setVisible(false);
gridComp.select(gridComp.getItemSelected());

        }

I have a View “A” with a list. When I click on an item in the list, I display another view “B” with the item detail

That code is execute when I want return to the first View “A” with the list

and how do you create the grids?

Thank you for your help but I don’t understand your question . I know only one way to create a grid with the class Grid. And I use DataProvider.<T, F>fromFilteringCallbacks to load the grid with the data.

Another thing, I store the UI elements of the view “A” ( grid, buttons, etc … ) with @UIScope

How do you add the columns? Are those component columns?

Okay. Yes with simply the method addColumn

can you show sthis code?

// ---------- Boitier ----------
Column colBoitier = gridComp
.addColumn(compo → compo.getboitierComp() == null ? “” : compo.getboitierComp().getNbNom())
.setHeader(new Label(“Boitier”)).setKey(“Boitier”).setWidth(“110px”).setResizable(true);

    // gérer l'alimentation de la colonne
    Column<ComposantT> colCodecomp = gridComp.addColumn(comp -> getResumeCodecomp(comp.getSetarifs()))
            .setHeader(new Label("Codes Compl.")).setKey("Codecomp").setWidth("250px").setResizable(true);

// ---------- Niveau de préférence ----------
gridComp.addColumn(compo → compo.getNivpref().getNivprefNom())
.setHeader(new Label(“Niveau de pr\u00e9f\u00e9rence”)).setKey(“Nivpref”).setWidth(“120px”)
.setResizable(true);

It’s not all the code because I have several columns

after different tests, I think I’m not sure that the origin of my problem is “grid.select”.

Because when I comment this line I have the error in my browser.

I think it’s generated when The grid is reload (because the UI is stored with UIScoped annotation) when I return in my view.

And My line selected before is lost when I have the bug. That’s why I 've tried to select the line by code at begining.

It’s weird because The error isn’t generated each time

and sometimes my line is selected and another moment the line is lost ?!