vaadin / vaadin/framework

Feature: Grid: get row index

Open
#10,935 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

I would like to propose new feature for Grid.

Ability to read row index.
The grid rows are ordered by selected ordering and can be reordered by user by clicking on header cells of sortable columns. It would be nice for programmer to be able to get index by row in current ordering or to get row by index.

int i = grid.getRowIndex(row);
T row = grid.getRow(index);

There are already such methods for header and footer rows (getFooterRow, getHeaderRow).

Example: We use Grid with data from DataProvider. Some of rows are of special type. We are implementing functionality that allow user to jump over these special rows using keyboard shortcuts. Jump to next or previous special row is done using grid.scrollTo(index) which takes the integer index.
Now we need to handle ordering/reordering of rows and mapping to index by ourself, but this information is already inside the Grid, so it would be fine when user can read it through public interface.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Grid's public API, including the existing getFooterRow and getHeaderRow methods, then inspect how DataProvider ordering relates to scrollTo(index). Done means the Grid exposes the requested row/index mapping for the current ordering through a public interface, with behavior covering reordered sortable columns.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.