update Table

update Table
This commit is contained in:
梁灏 2016-11-26 10:50:24 +08:00
parent 7f34c51030
commit 3d9e4f2065
2 changed files with 33 additions and 12 deletions

View file

@ -48,16 +48,17 @@
}, },
selectAll () { selectAll () {
const status = !this.isSelectAll; const status = !this.isSelectAll;
this.$parent.selectAll(status);
let tmpData = deepCopy(this.cloneData); // let tmpData = deepCopy(this.cloneData);
tmpData.forEach((data) => { // tmpData.forEach((data) => {
data._isChecked = status; // data._isChecked = status;
}); // });
this.cloneData = tmpData; // this.cloneData = tmpData;
//
if (status) { // if (status) {
this.$parent.selectAll(); // this.$parent.selectAll();
} // }
} }
} }
} }

View file

@ -18,7 +18,13 @@
:clone-data="cloneData"></table-body> :clone-data="cloneData"></table-body>
</div> </div>
<div :class="[prefixCls + '-fixed']"> <div :class="[prefixCls + '-fixed']">
<!--todo设置个div头部--> <!--todo 设置个div头部-->
<table-head
fixed
:prefix-cls="prefixCls"
:style="fixedTableStyle"
:columns="leftFixedColumns"
:clone-data="cloneData"></table-head>
<table-body <table-body
fixed fixed
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
@ -28,6 +34,12 @@
:clone-data="cloneData"></table-body> :clone-data="cloneData"></table-body>
</div> </div>
<div :class="[prefixCls + '-fixed-right']"> <div :class="[prefixCls + '-fixed-right']">
<table-head
fixed
:prefix-cls="prefixCls"
:style="fixedRightTableStyle"
:columns="rightFixedColumns"
:clone-data="cloneData"></table-head>
<table-body <table-body
fixed fixed
:prefix-cls="prefixCls" :prefix-cls="prefixCls"
@ -238,8 +250,16 @@
} }
this.$emit('on-selection-change', selection); this.$emit('on-selection-change', selection);
}, },
selectAll () { selectAll (status) {
this.$emit('on-select-all', this.getSelection()); let tmpData = deepCopy(this.cloneData);
tmpData.forEach((data) => {
data._isChecked = status;
});
this.cloneData = tmpData;
if (status) {
this.$emit('on-select-all', this.getSelection());
}
}, },
fixedHeader () { fixedHeader () {
if (!!this.height) { if (!!this.height) {