Skip to content

Commit fa5f1db

Browse files
committed
fix: fix
1 parent 8c56884 commit fa5f1db

File tree

2 files changed

+7
-48
lines changed

2 files changed

+7
-48
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ React.render(<Table columns={columns} data={data} />, mountNode);
9393
| expandable.defaultExpandedRowKeys | String[] | [] | initial expanded rows keys |
9494
| expandable.expandedRowKeys | String[] | | current expanded rows keys |
9595
| expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode | | Content render to expanded row |
96-
| expandable.expandedRowClassName | Function(recode, index, indent):string | | get expanded row's className |
96+
| expandable.expandedRowClassName | `string` \| `(recode, index, indent) => string` | | get expanded row's className |
9797
| expandable.expandRowByClick | boolean | | Support expand by click row |
9898
| expandable.expandIconColumnIndex | Number | 0 | The index of expandIcon which column will be inserted when expandIconAsCell is false |
9999
| expandable.expandIcon | props => ReactNode | | Customize expand icon |

docs/examples/virtual.tsx

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -188,38 +188,20 @@ const data: RecordType[] = new Array(4 * 10000).fill(null).map((_, index) => ({
188188
// ],
189189
}));
190190

191-
const Demo = () => {
192-
const table1Ref = React.useRef<Reference>();
193-
const table2Ref = React.useRef<Reference>();
191+
const Demo: React.FC = () => {
192+
const tableRef = React.useRef<Reference>();
194193
return (
195194
<div style={{ width: 800, padding: `0 64px` }}>
196-
<button
197-
onClick={() => {
198-
table1Ref.current?.scrollTo({ top: 9999999999999 });
199-
table2Ref.current?.scrollTo({ top: 9999999999999 });
200-
}}
201-
>
195+
<button onClick={() => tableRef.current?.scrollTo({ top: 9999999999999 })}>
202196
Scroll To End
203197
</button>
204-
<button
205-
onClick={() => {
206-
table1Ref.current?.scrollTo({ top: 0 });
207-
table2Ref.current?.scrollTo({ top: 0 });
208-
}}
209-
>
210-
Scroll To Start
211-
</button>
212-
<button
213-
onClick={() => {
214-
table1Ref.current?.scrollTo({ index: data.length - 1 });
215-
table2Ref.current?.scrollTo({ index: data.length - 1 });
216-
}}
217-
>
198+
<button onClick={() => tableRef.current?.scrollTo({ top: 0 })}>Scroll To Start</button>
199+
<button onClick={() => tableRef.current?.scrollTo({ index: data.length - 1 })}>
218200
Scroll To Key
219201
</button>
220202
<VirtualTable
221203
style={{ marginTop: 16 }}
222-
ref={table1Ref}
204+
ref={tableRef}
223205
columns={columns}
224206
// expandedRowRender={({ b, c }) => b || c}
225207
scroll={{ x: 1300, y: 200 }}
@@ -240,29 +222,6 @@ const Demo = () => {
240222
return mergedWidth;
241223
}}
242224
/>
243-
<VirtualTable
244-
style={{ marginTop: 16 }}
245-
ref={table2Ref}
246-
columns={columns}
247-
// expandedRowRender={({ b, c }) => b || c}
248-
scroll={{ x: 1300, y: 200 }}
249-
data={data}
250-
// data={[]}
251-
rowKey="indexKey"
252-
expandable={{
253-
expandedRowRender: () => 2333,
254-
columnWidth: 60,
255-
expandedRowClassName: 'good-one-string',
256-
}}
257-
// onRow={() => ({ className: 'rowed' })}
258-
rowClassName="nice-try"
259-
getContainerWidth={(ele, width) => {
260-
// Minus border
261-
const { borderInlineStartWidth } = getComputedStyle(ele.querySelector('.rc-table-tbody'));
262-
const mergedWidth = width - parseInt(borderInlineStartWidth, 10);
263-
return mergedWidth;
264-
}}
265-
/>
266225
</div>
267226
);
268227
};

0 commit comments

Comments
 (0)