Skip to content

Commit 8934c14

Browse files
authored
fix(example/virtual-list-grid): 修复当修改table的dataSource时,没有拿到scrollBodyRef.scrollLeft而导致的header的滚动位置不正确 (#833)
1 parent 01d0032 commit 8934c14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/examples/virtual-list-grid.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ const Demo = () => {
2727
const [connectObject] = React.useState<any>(() => {
2828
const obj = {};
2929
Object.defineProperty(obj, 'scrollLeft', {
30-
get: () => null,
30+
get: () => {
31+
if (gridRef.current) {
32+
return gridRef.current?.state?.scrollLeft;
33+
}
34+
return null;
35+
},
3136
set: (scrollLeft: number) => {
3237
if (gridRef.current) {
3338
gridRef.current.scrollTo({ scrollLeft });

0 commit comments

Comments
 (0)