mirror of https://github.com/ElemeFE/element
Merge pull request #2473 from QingWei-Li/fix/table-column-key
Table: fix columnKey, fixed #2322pull/2505/head
commit
8453db88e5
|
@ -182,8 +182,7 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
this.customRender = this.$options.render;
|
this.customRender = this.$options.render;
|
||||||
this.$options.render = h => h('div', this.$slots.default);
|
this.$options.render = h => h('div', this.$slots.default);
|
||||||
|
this.columnId = (this.$parent.tableId || (this.$parent.columnId + '_')) + 'column_' + columnIdSeed++;
|
||||||
let columnId = this.columnId = this.columnKey || ((this.$parent.tableId || (this.$parent.columnId + '_')) + 'column_' + columnIdSeed++);
|
|
||||||
|
|
||||||
let parent = this.$parent;
|
let parent = this.$parent;
|
||||||
let owner = this.owner;
|
let owner = this.owner;
|
||||||
|
@ -210,7 +209,8 @@ export default {
|
||||||
let isColumnGroup = false;
|
let isColumnGroup = false;
|
||||||
|
|
||||||
let column = getDefaultColumn(type, {
|
let column = getDefaultColumn(type, {
|
||||||
id: columnId,
|
id: this.columnId,
|
||||||
|
columnKey: this.columnKey,
|
||||||
label: this.label,
|
label: this.label,
|
||||||
className: this.className,
|
className: this.className,
|
||||||
property: this.prop || this.property,
|
property: this.prop || this.property,
|
||||||
|
|
|
@ -152,15 +152,17 @@ TableStore.prototype.mutations = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const prop = column.property;
|
const prop = column.property;
|
||||||
|
const filters = [];
|
||||||
|
|
||||||
if (prop) {
|
if (prop) {
|
||||||
states.filters[column.id] = values;
|
states.filters[column.id] = values;
|
||||||
|
filters[column.columnKey || column.id] = values;
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = states._data;
|
let data = states._data;
|
||||||
const filters = states.filters;
|
|
||||||
|
|
||||||
Object.keys(filters).forEach((columnId) => {
|
Object.keys(states.filters).forEach((columnId) => {
|
||||||
const values = filters[columnId];
|
const values = states.filters[columnId];
|
||||||
if (!values || values.length === 0) return;
|
if (!values || values.length === 0) return;
|
||||||
const column = getColumnById(this.states, columnId);
|
const column = getColumnById(this.states, columnId);
|
||||||
if (column && column.filterMethod) {
|
if (column && column.filterMethod) {
|
||||||
|
|
Loading…
Reference in New Issue