Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table: fix header gutter not display #17341

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/table/src/layout-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export default {
},

methods: {
onColumnsChange() {
onColumnsChange(layout) {
const cols = this.$el.querySelectorAll('colgroup > col');
if (!cols.length) return;
const flattenColumns = this.tableLayout.getFlattenColumns();
const flattenColumns = layout.getFlattenColumns();
const columnsMap = {};
flattenColumns.forEach((column) => {
columnsMap[column.id] = column;
Expand Down
3 changes: 2 additions & 1 deletion packages/table/src/table-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class TableLayout {
if (this.showHeader && !headerWrapper) return;

// fix issue (https://github.com/ElemeFE/element/pull/16956)
const headerTrElm = headerWrapper.querySelector('.el-table__header tr');
const headerTrElm = headerWrapper ? headerWrapper.querySelector('.el-table__header tr') : null;
const noneHeader = this.headerDisplayNone(headerTrElm);

const headerHeight = this.headerHeight = !this.showHeader ? 0 : headerWrapper.offsetHeight;
Expand All @@ -119,6 +119,7 @@ class TableLayout {
}

headerDisplayNone(elm) {
if (!elm) return true;
let headerChild = elm;
while (headerChild.tagName !== 'DIV') {
if (getComputedStyle(headerChild).display === 'none') {
Expand Down
1 change: 1 addition & 0 deletions packages/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
updateScrollY() {
const changed = this.layout.updateScrollY();
if (changed) {
this.layout.notifyObservers('scrollable');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luckyCao 主要的修改在这一行。

this.layout.updateColumnsWidth();
}
},
Expand Down