Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import userEvent from '@testing-library/user-event';

describe('FilterableTable', () => {
const mockedProps = {
orderedColumnKeys: ['a', 'b', 'c'],
orderedColumnKeys: ['a', 'b', 'c', 'children'],
data: [
{ a: 'a1', b: 'b1', c: 'c1', d: 0 },
{ a: 'a2', b: 'b2', c: 'c2', d: 100 },
{ a: null, b: 'b3', c: 'c3', d: 50 },
{ a: 'a1', b: 'b1', c: 'c1', d: 0, children: 0 },
{ a: 'a2', b: 'b2', c: 'c2', d: 100, children: 2 },
{ a: null, b: 'b3', c: 'c3', d: 50, children: 1 },
],
height: 500,
};
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/components/FilterableTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ const FilterableTable = ({
usePagination={false}
columns={columns}
data={filteredList}
childrenColumnName=""
virtualize
bordered
/>
Expand Down
10 changes: 10 additions & 0 deletions superset-frontend/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ export interface TableProps<RecordType> {
* only supported for virtualize == true
*/
allowHTML?: boolean;

/**
* The column that contains children to display.
* Check https://ant.design/components/table#table for more details.
*/
childrenColumnName?: string;
}

const defaultRowSelection: React.Key[] = [];
Expand Down Expand Up @@ -259,6 +265,7 @@ export function Table<RecordType extends object>(
recordCount,
onRow,
allowHTML = false,
childrenColumnName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinpark childrenColumnName is not a direct property of the table. It belongs to the expandable configuration:

<Table 
   expandable={
      childrenColumnName: 'children',
   }
>

} = props;

const wrapperRef = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -392,6 +399,9 @@ export function Table<RecordType extends object>(
theme,
height: bodyHeight,
bordered,
expandable: {
childrenColumnName,
},
};

return (
Expand Down