url ids

I have a grid list of users. When an admin clicks on a row I want it to navigate to that users page. For example if I click a user from the grid with ID 1 then it should navigate to /users/{1}. How can I do this with Vaadin?

You could use do this:

grid.addItemClickListener(event -> {
            grid.getUI().ifPresent(ui -> ui.navigate(
                    UserProfileEdit.class, event.getItem().getId()))
        })

It’s not accessible and I usually prefer to create a new column with a Routerlink to the page.

grid.addComponentColumn(item -> new RouterLink("Edit", UserProfileEdit.class, item.getId()));