Comcast / Comcast/react-data-grid
Inconsistent API for column indexes
- Lingua principale
- TypeScript
- Stelle
- 7.7k
- Fork
- 2.2k
- Merge medio
- 1g 2h
- PR unite (30g)
- 33
Descrizione
## 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?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia esaminando le API pubbliche openEditor e selectCell e tracciando il modo in cui i relativi indici di colonna e riga vengono interpretati dopo che le colonne sono state bloccate o riordinate. Usa l’esempio A, B, C per verificare che la cella selezionata continui a identificare in modo coerente la colonna originale dall’esterno della griglia.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- react, typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100