Skip to content

Commit eb6c692

Browse files
author
huangshuwei
committed
fix expand bug when column fixed
1 parent 5ba61c6 commit eb6c692

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default {
8585
return result;
8686
},
8787

88-
// is last left fixed column
88+
// has left fixed column
8989
hasLeftFixedColumn() {
9090
return this.colgroups.some(x => x.fixed === "left");
9191
},

packages/ve-table/src/index.jsx

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import Footer from "./footer";
1414
import { KEY_CODES } from "../../src/utils/constant";
1515
import { isEmptyValue } from "../../src/utils/index";
1616
import clickoutside from "../../src/directives/clickoutside";
17+
import { mutations } from "./util/store";
18+
import VueDomResizeObserver from "../../src/comps/resize-observer";
1719

1820
// virtual scroll positions
1921
let virtualScrollPositions = [
@@ -404,6 +406,10 @@ export default {
404406
return this.colgroups.some(
405407
x => x.fixed === "left" || x.fixed === "right"
406408
);
409+
},
410+
// is last left fixed column
411+
hasLeftFixedColumn() {
412+
return this.colgroups.some(x => x.fixed === "left");
407413
}
408414
},
409415
watch: {
@@ -751,12 +757,39 @@ export default {
751757
getVirtualViewPhantom() {
752758
let content = null;
753759

754-
if (this.isVirtualScroll) {
760+
/*
761+
1、is virtualScroll
762+
or
763+
2、
764+
has left fixed column and expand option(resolve expand row content sticky)
765+
*/
766+
if (
767+
this.isVirtualScroll ||
768+
(this.hasLeftFixedColumn && this.expandOption)
769+
) {
770+
const props = {
771+
props: {
772+
tagName: "div"
773+
},
774+
style: {
775+
width: "100%"
776+
},
777+
on: {
778+
"on-dom-resize-change": ({ width }) => {
779+
mutations.setStore({
780+
tableViewportWidth: width
781+
});
782+
}
783+
}
784+
};
785+
755786
content = (
756787
<div
757788
ref={this.virtualPhantomRef}
758789
class={clsName("virtual-phantom")}
759-
></div>
790+
>
791+
<VueDomResizeObserver {...props} />
792+
</div>
760793
);
761794
}
762795

0 commit comments

Comments
 (0)