Comcast / Comcast/react-data-grid
Inconsistent API for column indexes
- Vorherrschende Sprache
- TypeScript
- Sterne
- 7.7k
- Forks
- 2.2k
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 33
Beschreibung
## Description
There is an inconsistency in the API related to how column and row indexes are passed or returned in specific methods.
Some methods (for example: `openEditor`) provide or expect only the column/row index, rather than the original column identifier.
This causes issues when the grid’s internal state changes, such as when columns are pinned.
As a result, the indices can differ from the original ones that were passed into the grid, and it becomes impossible to determine from the outside which column index refers to.
## Issue Details
- There is **no reliable way** to map the given index back to a specific column outside the grid.
- This makes it difficult to synchronize or manage external state related to columns.
## Expected Behavior
The API should provide a **consistent way** to identify columns, regardless of internal reordering.
## Actual Behavior
When the grid updates its internal state (due to sorting, pinning, etc.), previously valid indexes no longer refer to the same columns or rows, breaking external logic that relies on them.
## Example
1. Pass data with three columns: A, B, C.
2. Pin column B.
3. Call `selectCell({idx: 2, rowIdx: 1);`
**Expected behavior:** opened 1st cell of the pinned column B
**Current behavior:** opened 1st cell of column A
## Suggested Fix
Standardize the API to use **original column indices**
> Update: https://github.com/Comcast/react-data-grid/compare/main...dbeaver:react-data-grid:add-select-cell-by-key-api - this is my suggestion to show you what can fix the situation
Could you help us solve the issue or suggest an alternative approach to nail it?
Beitragsleitfaden
Rechercherichtung
Beginnen Sie mit der Überprüfung der öffentlichen openEditor- und selectCell-APIs und verfolgen Sie, wie ihre Spalten- und Zeilenindizes interpretiert werden, nachdem Spalten fixiert oder neu angeordnet wurden. Verwenden Sie das Beispiel A, B, C, um zu überprüfen, dass die ausgewählte Zelle die ursprüngliche Spalte von außerhalb des Grids weiterhin konsistent identifiziert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react, typescript
- Bereich
- frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100