Skip to content

Commit aa6e206

Browse files
committed
fix: not render if no data
1 parent eb0589b commit aa6e206

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

docs/examples/virtual.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ const Demo = () => {
199199
columns={columns}
200200
// expandedRowRender={({ b, c }) => b || c}
201201
scroll={{ x: 1200, y: scrollY ? 200 : null }}
202-
data={data}
202+
// data={data}
203+
data={[]}
203204
rowKey="indexKey"
204205
expandable={{
205206
expandedRowRender: () => 2333,

src/VirtualTable/BodyGrid.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ const Grid = React.forwardRef<GridRef, GridProps>((props, ref) => {
8989
const extraRender: ListProps<any>['extraRender'] = info => {
9090
const { start, end, getSize, offsetY } = info;
9191

92+
// Do nothing if no data
93+
if (end < 0) {
94+
return null;
95+
}
96+
9297
// Find first rowSpan column
9398
let firstRowSpanColumns = flattenColumns.filter(
9499
// rowSpan is 0

src/VirtualTable/BodyLine.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ const BodyLine = React.forwardRef<HTMLDivElement, BodyLineProps>((props, ref) =>
4646
if (fixColumn) {
4747
additionalProps = {
4848
style: {
49-
position: 'sticky',
50-
left: 0,
51-
overflow: 'hidden',
5249
['--virtual-width' as any]: `${componentWidth}px`,
5350
},
5451
};

0 commit comments

Comments
 (0)