Merge pull request #101 from QingWei-Li/feat/next-buglist0825

Fix buglist 0825
pull/2/head
baiyaaaaa 2016-08-26 10:16:46 +08:00 committed by GitHub
commit 073b791519
4 changed files with 21 additions and 14 deletions

View File

@ -76,7 +76,8 @@
address: '上海市普陀区金沙江路 1518 弄'
}],
singleSelection: {},
multipleSelection: []
multipleSelection: [],
model: ''
};
},

View File

@ -676,4 +676,5 @@ Table 组件中,只要在列中设置`sortable`属性即可实现以该列为
| type | 对应列的类型。如果设置了 `selection` 则显示多选按钮,如果设置了 `index` 则显示该行的索引(从 1 开始计算) | string | 'selection', 'index' | 0 |
| formatter | 用来格式化内容,在 formatter 执行的时候,会传入 row 和 column | function | | |
| show-tooltip-when-overflow | 当过长被隐藏时显示 tooltip | Boolean | | false |
| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息。此时不需要配置 property 属性 | | |
| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息,通过 _self 获取当前上下文。此时不需要配置 property 属性 | | |

View File

@ -44,7 +44,7 @@ export default {
on-click={ ($event) => this.handleClick($event, row) }
on-mouseenter={ _ => this.handleMouseEnter($index) }
class={{
'current-row': row === this.$parent.$parent.selected,
'current-row': row === this.$parent.selected,
'hover': this.$parent.$parent.hoverRowIndex === $index,
'positive-row': row.$positive,
'info-row': row.$info,
@ -59,7 +59,7 @@ export default {
on-mouseleave={ this.handleCellMouseLeave }>
{
column.template
? column.template.call(this._renderProxy, h, { row, column, $index })
? column.template.call(this._renderProxy, h, { row, column, $index, _self: this.$parent.$parent })
: <div class="cell">{ this.$getPropertyText(row, column.property, column.id) }</div>
}
</td>
@ -131,7 +131,6 @@ export default {
if (grid.selectionMode === 'single') {
grid.selected = row;
grid.$emit('selectionchange', row);
}
grid.$emit('rowclick', row, event);

View File

@ -251,8 +251,9 @@
gridWrapper.style.height = bodyHeight + 'px';
this.$el.style.height = height + 'px';
this.$refs.fixed.style.height = height + 'px';
if (this.$refs.fixed) {
this.$refs.fixed.style.height = height + 'px';
}
const fixedBodyWrapper = this.$el.querySelector('.el-table__fixed-body-wrapper');
if (fixedBodyWrapper) {
fixedBodyWrapper.style.height = (this.showHScrollBar ? gridWrapper.offsetHeight - this.currentGutterWidth : gridWrapper.offsetHeight) + 'px';
@ -312,7 +313,6 @@
},
created() {
this.tableData = this.data;
this.gridId = 'grid_' + gridIdSeed + '_';
if (GUTTER_WIDTH === undefined) {
@ -370,6 +370,14 @@
this.$calcHeight(value);
},
data(val) {
if (val && this.selectionMode === 'multiple') {
this.tableData = val.map(item => objectAssign({ '$selected': false }, item));
} else {
this.tableData = val;
}
},
tableData(newVal) {
this.doOnDataChange(newVal);
this.updateScrollInfo();
@ -395,10 +403,6 @@
this.styleNode = styleNode;
if (this.tableData && this.selectionMode === 'multiple') {
this.tableData = this.tableData.map(item => objectAssign({ '$selected': false }, item));
}
this.doRender();
this.$ready = true;
@ -408,14 +412,16 @@
this.updateScrollInfo();
if (this.fixedColumnCount > 0) {
this.$nextTick(() => {
this.$refs.fixed.style.height = this.$el.clientHeight + 'px';
const style = this.$refs.fixed.style;
if (!style) return;
style.height = this.$el.clientHeight + 'px';
});
}
},
data() {
return {
tableData: [],
tableData: this.data,
showHScrollBar: false,
showVScrollBar: false,
hoverRowIndex: null,