Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

rowExpandable does not work when dataSource has children field

Aperta
#1,416 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react-component/table

Tutte le issue di react-component/table

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.