Merge pull request #2473 from QingWei-Li/fix/table-column-key

Table: fix columnKey, fixed #2322
This commit is contained in:
baiyaaaaa 2017-01-18 17:06:27 +08:00 committed by GitHub
commit 8453db88e5
2 changed files with 8 additions and 6 deletions

View File

@ -182,8 +182,7 @@ export default {
created() {
this.customRender = this.$options.render;
this.$options.render = h => h('div', this.$slots.default);
let columnId = this.columnId = this.columnKey || ((this.$parent.tableId || (this.$parent.columnId + '_')) + 'column_' + columnIdSeed++);
this.columnId = (this.$parent.tableId || (this.$parent.columnId + '_')) + 'column_' + columnIdSeed++;
let parent = this.$parent;
let owner = this.owner;
@ -210,7 +209,8 @@ export default {
let isColumnGroup = false;
let column = getDefaultColumn(type, {
id: columnId,
id: this.columnId,
columnKey: this.columnKey,
label: this.label,
className: this.className,
property: this.prop || this.property,

View File

@ -152,15 +152,17 @@ TableStore.prototype.mutations = {
}
const prop = column.property;
const filters = [];
if (prop) {
states.filters[column.id] = values;
filters[column.columnKey || column.id] = values;
}
let data = states._data;
const filters = states.filters;
Object.keys(filters).forEach((columnId) => {
const values = filters[columnId];
Object.keys(states.filters).forEach((columnId) => {
const values = states.filters[columnId];
if (!values || values.length === 0) return;
const column = getColumnById(this.states, columnId);
if (column && column.filterMethod) {