From f70b08e0afbbcd48e27008ac72a8935f477f80df Mon Sep 17 00:00:00 2001 From: Ivan Seidel Date: Wed, 10 Oct 2018 17:17:40 -0300 Subject: [PATCH] Table: Adds header rendering slot Fixes #4909 and #4908 --- examples/docs/en-US/table.md | 76 +++++++++++++++++++++++++++++- packages/table/src/table-column.js | 4 ++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/examples/docs/en-US/table.md b/examples/docs/en-US/table.md index 1795db0dbf..89afbcece4 100644 --- a/examples/docs/en-US/table.md +++ b/examples/docs/en-US/table.md @@ -186,7 +186,8 @@ amount3: 15 }], currentRow: null, - multipleSelection: [] + multipleSelection: [], + search: '', }; }, @@ -1500,6 +1501,79 @@ Customize table column so it can be integrated with other components. ``` ::: +### Table with custom header + +Customize table header so it can be even more customized. +:::demo You can customize how the header looks by [Default slot content](https://vuejs.org/v2/guide/components-slots.html#Default-Slot-Content). +```html + + + +``` +::: + ### Expandable row When the row content is too long and you do not want to display the horizontal scroll bar, you can use the expandable row feature. diff --git a/packages/table/src/table-column.js b/packages/table/src/table-column.js index 60f9971ab5..1cf14323e9 100644 --- a/packages/table/src/table-column.js +++ b/packages/table/src/table-column.js @@ -444,6 +444,10 @@ export default { columnIndex = [].indexOf.call(parent.$el.children, this.$el); } + if (this.$scopedSlots.header) { + this.columnConfig.renderHeader = this.$scopedSlots.header; + } + owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null); } };