rowExpandable does not work when dataSource has children field
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia dal punto di ingresso Table e traccia come viene gestito expandable.rowExpandable quando i record includono children. Riproduci l’esempio con un array children valorizzato e uno vuoto, quindi verifica che solo la prima riga mostri un’icona di espansione e che rowExpandable venga invocato in modalità albero.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When using rc-table with tree data structure (when dataSource contains children field), the rowExpandable configuration is completely ignored. This prevents developers from controlling which rows should be expandable based on custom logic.
Current Behavior
When dataSource contains children field, the table automatically enables tree mode
In tree mode, the presence of children field alone determines expandability, regardless of its content
Empty children arrays ([]) still show expand icons
The rowExpandable function is never called or its return value is ignored
Expected Behavior
rowExpandable should work consistently regardless of whether the table is in tree mode or not
Developers should be able to control expandability using custom logic even when children field exists
When rowExpandable returns false for a row, it should not show expand icon regardless of children field
import { Table } from 'rc-table';
const dataSource = [
{
key: '1',
name: 'Parent 1',
children: [
{ key: '1-1', name: 'Child 1-1' },
],
},
{
key: '2',
name: 'Parent 2',
children: [], // Empty children - should not be expandable
},
];
const columns = [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
},
];
const App = () => (
<Table
dataSource={dataSource}
columns={columns}
expandable={{
// This is ignored because children field exists
rowExpandable: (record) =>
record.children && record.children.length > 0
}}
/>
);
In this example, both rows show expand icons, but the second row should not be expandable since its children array is empty.
- Lingua principale
- TypeScript
- Stelle
- 1.4k
- Fork
- 618
- Merge medio
- 10h 19m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di react-component/table
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
react-component/table#1507 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
react-component/table#1403 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
react-component/table#1269 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
react-component/table#1257 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
react-component/table#1228 ·
Tutte le issue di react-component/table
Issue simili
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
Mend: dependency security vulnerability untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100