Skip to content

Commit 8fbab54

Browse files
author
huangshuwei
committed
fix expand bug when column fixed
1 parent 8c78d0f commit 8fbab54

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

packages/style/ve-table.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,15 @@
319319
}
320320
}
321321
}
322+
323+
// expand row
324+
.ve-table-expand-tr {
325+
.ve-table-fixed-left {
326+
position: sticky;
327+
z-index: @ve-fixed-body-cell-index;
328+
left: 10px;
329+
}
330+
}
322331
}
323332

324333
// tfooter

packages/ve-table/src/body/expand-tr.jsx

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,33 @@ export default {
7575
result[clsName("expand-tr-show")] = true;
7676
}
7777

78+
return result;
79+
},
80+
81+
// is last left fixed column
82+
lastLeftFixedColumn() {
83+
let result = null;
84+
85+
const fixedLeftColumns = this.colgroups.filter(
86+
x => x.fixed === "left"
87+
);
88+
89+
if (fixedLeftColumns.length > 0) {
90+
result = fixedLeftColumns[fixedLeftColumns.length - 1].field;
91+
}
92+
93+
return result;
94+
},
95+
96+
// expand td class
97+
expandTdClass() {
98+
let result = {
99+
[clsName("expand-td")]: true
100+
};
101+
102+
if (this.lastLeftFixedColumn) {
103+
result[clsName("fixed-left")] = true;
104+
}
78105
return result;
79106
}
80107
},
@@ -96,13 +123,18 @@ export default {
96123
}
97124
},
98125
render(h) {
99-
const { columnCount, getExpandRowContent, expanRowStyle } = this;
126+
const {
127+
columnCount,
128+
getExpandRowContent,
129+
expanRowStyle,
130+
expandTdClass
131+
} = this;
100132

101133
let content = getExpandRowContent(h);
102134

103135
let result = (
104136
<tr class={this.expanRowClass}>
105-
<td class={clsName("expand-td")} colSpan={columnCount}>
137+
<td class={expandTdClass} colSpan={columnCount}>
106138
{content}
107139
</td>
108140
</tr>

0 commit comments

Comments
 (0)