Select row in a Grid afrer refresh

When I refresh my grid from code I need to select the first (or another) item.

However if I do this just after my refreshAll() it doesn’t work :data are not yet read from the DB.

After a while, I suspect in an asynchronous way, data are read but I didn’t find any possibility to select the required item.

Is it possible ? How ?


Hi, tried with the following and it worked fine:

add(new Button("Refresh and select", e -> {

Please provide a code example that reproduces the issue so we can take a better look.

Also, make sure that your items have equals/hashCode properly implemented. If not, selection (and many other things) might not work as you’d expect.

Sorry what’s peole in Your example ?

My data comes from DB, I’ve no array of data in memory.


Sorry what’s peole in Your example ?

It’s the Person bean from

I understand but where can I find it ?

How can I ask the grid : tell me what’s Your first item ?

I’m not using any listed data provider but a data provider getting data from a database.


Anyway I tested your solution without a button and I found a problem : when refresh is executed showing the page for the first time data are not already loaded and then I’ve not the first row.