Vaadin 8: How to get number of rows in Grid

I want to dirplay the current number of rows of a Grid in my UI but I counld not find a method like “getRowCount” in Grid.
Any idea how can I get the number of all (filtered) rows of a Grid?


Grid’s not aware of a row count by design, as there might be more data waiting to be loaded. Check the DataProvider to see the amount of items you have.

Best regards,


I don’t know how this is by design, as the UI anyways shows the amount of rows and asks it from the backen, no matter what kind of DataProvider you use. IMO the Grid API should definitely have some kind of method suggested by Alexander. If we at some point really support a data source what don’t know the amount of rows (which would be awesome for performnce with large datasests and/or filtering), the method could just throw exception or loop through all rows.

Alexander, would you add an enhancement issue to about this?


I have raised

this one should do the thing you want…



Christian, Containers (containerDataSouce) are no more available in the V8 grid.

Alexander, I created a patch with the feature hoping to get it through to bugix release already.

Hi Matti,
thx for response… its getting time for me to read about the new version.
Do you know how long the Vaadin-7 branch will be supported?

I have grid with data provider and I want programatically to select next and previous item in it (arrows left/right or up/down).
What is possible solution for this?

  Question selected = questions.asSingleSelect().getValue();
  if(listQuestionsCurrent!=null) {
    int currentQuestionOrdNum =  listQuestionsCurrent.indexOf(selected);
    if(currentQuestionOrdNum-1 >= 0) {;

Problem is how to maintain current grid items list in order to know ordinal number of selected item in list. When you select item on first load it works, but if you scroll further down it is lost.

And I thought that I was moving forward migrating projects to V8 :skull_and_crossbones:, all tables in all languages has a SIZE() LENGTH() ROWCOUNT() but not Vaadin8

I couldn’t agree more. This is such a basic API that it should just exist. This is the issue to follow: