@@ -8,8 +8,54 @@ interface RecordType {
88 a ?: string ;
99 b ?: string ;
1010 c ?: string ;
11+ d ?: number ;
12+ key ?: string ;
1113}
1214
15+ const fixedColumns : ColumnType < RecordType > [ ] = [
16+ { title : 'title1' , dataIndex : 'a' , key : 'a' , width : 100 , fixed : 'left' } ,
17+ { title : 'title2' , dataIndex : 'b' , key : 'b' , width : 100 , fixed : 'left' , ellipsis : true } ,
18+ { title : 'title3' , dataIndex : 'c' , key : 'c' } ,
19+ { title : 'title4' , dataIndex : 'b' , key : 'd' } ,
20+ { title : 'title5' , dataIndex : 'b' , key : 'e' } ,
21+ { title : 'title6' , dataIndex : 'b' , key : 'f' } ,
22+ {
23+ title : (
24+ < div >
25+ title7
26+ < br />
27+ < br />
28+ < br />
29+ Hello world!
30+ </ div >
31+ ) ,
32+ dataIndex : 'b' ,
33+ key : 'g' ,
34+ } ,
35+ { title : 'title8' , dataIndex : 'b' , key : 'h' } ,
36+ { title : 'title9' , dataIndex : 'b' , key : 'i' } ,
37+ { title : 'title10' , dataIndex : 'b' , key : 'j' } ,
38+ { title : 'title11' , dataIndex : 'b' , key : 'k' } ,
39+ { title : 'title12' , dataIndex : 'b' , key : 'l' , width : 100 , fixed : 'right' } ,
40+ ] ;
41+
42+ const fixedData = [
43+ {
44+ a : '123' ,
45+ b : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ,
46+ d : 3 ,
47+ key : '1' ,
48+ } ,
49+ { a : 'cdd' , b : 'edd12221' , d : 3 , key : '2' } ,
50+ { a : '133' , c : 'edd12221' , d : 2 , key : '3' } ,
51+ { a : '133' , c : 'edd12221' , d : 2 , key : '4' } ,
52+ { a : '133' , c : 'edd12221' , d : 2 , key : '5' } ,
53+ { a : '133' , c : 'edd12221' , d : 2 , key : '6' } ,
54+ { a : '133' , c : 'edd12221' , d : 2 , key : '7' } ,
55+ { a : '133' , c : 'edd12221' , d : 2 , key : '8' } ,
56+ { a : '133' , c : 'edd12221' , d : 2 , key : '9' } ,
57+ ] ;
58+
1359const columns : ColumnType < { a : string ; b : string ; c : string } > [ ] = [
1460 { title : 'title1' , dataIndex : 'a' , key : 'a' , width : 100 } ,
1561 { title : 'title2' , dataIndex : 'b' , key : 'b' , width : 100 , align : 'right' } ,
@@ -108,6 +154,37 @@ const Demo = () => (
108154 marginBottom : 100 ,
109155 } }
110156 />
157+
158+ < h2 > Sticky with fixed columns</ h2 >
159+ < div style = { { width : 800 } } >
160+ < Table < RecordType >
161+ columns = { fixedColumns }
162+ data = { fixedData }
163+ sticky
164+ scroll = { {
165+ x : 1200 ,
166+ } }
167+ style = { {
168+ marginBottom : 100 ,
169+ } }
170+ />
171+ </ div >
172+
173+ < h2 > Sticky with fixed columns and scroll.y</ h2 >
174+ < div style = { { width : 800 } } >
175+ < Table < RecordType >
176+ columns = { fixedColumns }
177+ data = { fixedData }
178+ sticky
179+ scroll = { {
180+ x : 1200 ,
181+ y : 300 ,
182+ } }
183+ style = { {
184+ marginBottom : 100 ,
185+ } }
186+ />
187+ </ div >
111188 </ div >
112189) ;
113190
0 commit comments