@@ -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