Datagrid SelectionListener

Hi, I need to launch screen edit on a row click instead on double click.
I think the solution is track event with SelectionListener.
I’ve no idea how to use it.
Have you an example?
Thank you very much

Hi,

You can use the addSelectionListener method in order to add a listener. In this listener you can obtain selected entity and open an edit screen.

@Inject
private DataGrid<User> dataGrid;
@Inject
private ScreenBuilders screenBuilders;


@Subscribe
private void onInit(InitEvent event) {
    dataGrid.addSelectionListener(selectionEvent -> {
        User singleSelected = dataGrid.getSingleSelected();
        if (singleSelected != null) {
            screenBuilders.editor(User.class, this)
                    .editEntity(singleSelected)
                    .build()
                    .show();
        }
    });
}

Regardsm
Gleb

Ok, thank you.
But I’m using pltaform 6.10.
How can I change your code?

Yes sorry, everything works perfectly.
I accidentally set the selectionmode grid property to none.
Thanks for your help