Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed Sep 29, 2024
1 parent 8c56884 commit fa5f1db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ React.render(<Table columns={columns} data={data} />, mountNode);
| expandable.defaultExpandedRowKeys | String[] | [] | initial expanded rows keys |
| expandable.expandedRowKeys | String[] | | current expanded rows keys |
| expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode | | Content render to expanded row |
| expandable.expandedRowClassName | Function(recode, index, indent):string | | get expanded row's className |
| expandable.expandedRowClassName | `string` \| `(recode, index, indent) => string` | | get expanded row's className |
| expandable.expandRowByClick | boolean | | Support expand by click row |
| expandable.expandIconColumnIndex | Number | 0 | The index of expandIcon which column will be inserted when expandIconAsCell is false |
| expandable.expandIcon | props => ReactNode | | Customize expand icon |
Expand Down
53 changes: 6 additions & 47 deletions docs/examples/virtual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,38 +188,20 @@ const data: RecordType[] = new Array(4 * 10000).fill(null).map((_, index) => ({
// ],
}));

const Demo = () => {
const table1Ref = React.useRef<Reference>();
const table2Ref = React.useRef<Reference>();
const Demo: React.FC = () => {
const tableRef = React.useRef<Reference>();
return (
<div style={{ width: 800, padding: `0 64px` }}>
<button
onClick={() => {
table1Ref.current?.scrollTo({ top: 9999999999999 });
table2Ref.current?.scrollTo({ top: 9999999999999 });
}}
>
<button onClick={() => tableRef.current?.scrollTo({ top: 9999999999999 })}>
Scroll To End
</button>
<button
onClick={() => {
table1Ref.current?.scrollTo({ top: 0 });
table2Ref.current?.scrollTo({ top: 0 });
}}
>
Scroll To Start
</button>
<button
onClick={() => {
table1Ref.current?.scrollTo({ index: data.length - 1 });
table2Ref.current?.scrollTo({ index: data.length - 1 });
}}
>
<button onClick={() => tableRef.current?.scrollTo({ top: 0 })}>Scroll To Start</button>
<button onClick={() => tableRef.current?.scrollTo({ index: data.length - 1 })}>
Scroll To Key
</button>
<VirtualTable
style={{ marginTop: 16 }}
ref={table1Ref}
ref={tableRef}
columns={columns}
// expandedRowRender={({ b, c }) => b || c}
scroll={{ x: 1300, y: 200 }}
Expand All @@ -240,29 +222,6 @@ const Demo = () => {
return mergedWidth;
}}
/>
<VirtualTable
style={{ marginTop: 16 }}
ref={table2Ref}
columns={columns}
// expandedRowRender={({ b, c }) => b || c}
scroll={{ x: 1300, y: 200 }}
data={data}
// data={[]}
rowKey="indexKey"
expandable={{
expandedRowRender: () => 2333,
columnWidth: 60,
expandedRowClassName: 'good-one-string',
}}
// onRow={() => ({ className: 'rowed' })}
rowClassName="nice-try"
getContainerWidth={(ele, width) => {
// Minus border
const { borderInlineStartWidth } = getComputedStyle(ele.querySelector('.rc-table-tbody'));
const mergedWidth = width - parseInt(borderInlineStartWidth, 10);
return mergedWidth;
}}
/>
</div>
);
};
Expand Down

0 comments on commit fa5f1db

Please sign in to comment.