Table: fix columnKey, fixed #2322

pull/2473/head
qingwei.li 2017-01-17 17:59:00 +08:00
parent 86288b4282
commit bfb4c9c3f1
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) {