From e37228e7a156187447a69934bb03436c45f6327b Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Tue, 3 Apr 2018 14:34:54 +0800 Subject: [PATCH] add table demo --- components/dropdown/src/Dropdown.jsx | 6 +- components/table/Table.jsx | 4 +- components/table/demo/edit-row.md | 20 ++-- components/table/demo/fixed-columns.md | 64 ++++++++++ components/table/demo/fixed-header.md | 50 ++++++++ components/table/demo/grouping-columns.md | 109 +++++++++++++++++ components/table/demo/head.md | 100 ++++++++++++++++ components/table/demo/nested-table.md | 136 ++++++++++++++++++++++ components/table/demo/reset-filter.md | 129 ++++++++++++++++++++ components/table/filterDropdown.jsx | 1 + components/vc-menu/SubMenu.jsx | 2 +- 11 files changed, 607 insertions(+), 14 deletions(-) create mode 100644 components/table/demo/fixed-columns.md create mode 100644 components/table/demo/fixed-header.md create mode 100644 components/table/demo/grouping-columns.md create mode 100644 components/table/demo/head.md create mode 100644 components/table/demo/nested-table.md create mode 100644 components/table/demo/reset-filter.md diff --git a/components/dropdown/src/Dropdown.jsx b/components/dropdown/src/Dropdown.jsx index 262513a6a..f535eaaa2 100644 --- a/components/dropdown/src/Dropdown.jsx +++ b/components/dropdown/src/Dropdown.jsx @@ -70,14 +70,16 @@ export default { getMenuElement () { const { onClick, prefixCls, $slots } = this this.childOriginEvents = getEvents($slots.overlay[0]) - return cloneElement($slots.overlay[0], { + const extraOverlayProps = { props: { prefixCls: `${prefixCls}-menu`, + getPopupContainer: () => this.getPopupDomNode(), }, on: { click: onClick, }, - }) + } + return cloneElement($slots.overlay[0], extraOverlayProps) }, getPopupDomNode () { diff --git a/components/table/Table.jsx b/components/table/Table.jsx index 0cf411b60..03df56a90 100755 --- a/components/table/Table.jsx +++ b/components/table/Table.jsx @@ -133,12 +133,12 @@ export default { const filteredValueColumns = this.getFilteredValueColumns(val) if (filteredValueColumns.length > 0) { const filtersFromColumns = this.getFiltersFromColumns(val) - const newFilters = { ...this.state.filters } + const newFilters = { ...this.sFilters } Object.keys(filtersFromColumns).forEach(key => { newFilters[key] = filtersFromColumns[key] }) if (this.isFiltersChanged(newFilters)) { - this.setState({ filters: newFilters }) + this.setState({ sFilters: newFilters }) } } }, diff --git a/components/table/demo/edit-row.md b/components/table/demo/edit-row.md index fd243c112..7de22b940 100644 --- a/components/table/demo/edit-row.md +++ b/components/table/demo/edit-row.md @@ -11,15 +11,17 @@ Table with editable rows. ```html