fix: headerScrol=true数据量大时,表头和表体滚动条长度不一致

This commit is contained in:
izbz wh 2019-04-09 15:56:33 +08:00
parent acf29b253a
commit 4198316b1b
7 changed files with 28 additions and 30 deletions

View File

@ -387,11 +387,10 @@ var Table = function (_Component) {
var bodyH = this.refs.bodyTable.clientHeight;
var bodyContentH = this.refs.bodyTable.querySelector('table').clientHeight;
var rightBodyTable = this.refs.fixedColumnsBodyRight;
if (bodyContentH <= bodyH) {
this.refs.bodyTable.style.overflowY = 'auto';
this.refs.headTable.style.overflowY = 'auto';
rightBodyTable && (rightBodyTable.style.overflowY = 'auto');
}
var overflowy = bodyContentH <= bodyH ? 'auto' : 'scroll';
this.refs.bodyTable.style.overflowY = overflowy;
this.refs.headTable.style.overflowY = overflowy;
rightBodyTable && (rightBodyTable.style.overflowY = overflowy);
}
};

View File

@ -63,7 +63,7 @@ class Demo12 extends Component {
getSelectedDataFunc = (selectedList,record,index) => {
console.log("selectedList", selectedList,"index",index);
// 如果在回调中增加setState逻辑需要同步data中的_checked属性。即下面的代码
const allChecked = selectedList.length == 0?false:true;
// const allChecked = selectedList.length == 0?false:true;
// record为undefind则为全选或者全不选
// if(!record){
// data12.forEach(item=>{

View File

@ -53,7 +53,7 @@ const data5 = [
class Demo5 extends Component {
render() {
return <Table columns={columns5} data={data5} scroll={{ x: "110%", y: 340 }} bodyStyle={{height:'340px'}} />;
return <Table columns={columns5} data={data5} scroll={{ x: "110%", y: 240 }} />;
}
}

File diff suppressed because one or more lines are too long

30
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -277,12 +277,11 @@ class Table extends Component {
const bodyH = this.refs.bodyTable.clientHeight;
const bodyContentH = this.refs.bodyTable.querySelector('table').clientHeight;
const rightBodyTable = this.refs.fixedColumnsBodyRight;
if(bodyContentH <= bodyH){
this.refs.bodyTable.style.overflowY='auto';
this.refs.headTable.style.overflowY='auto';
rightBodyTable && (rightBodyTable.style.overflowY='auto');
const overflowy = bodyContentH <= bodyH ? 'auto':'scroll';
this.refs.bodyTable.style.overflowY = overflowy;
this.refs.headTable.style.overflowY = overflowy;
rightBodyTable && (rightBodyTable.style.overflowY = overflowy);
}
}
}
onExpandedRowsChange(expandedRowKeys) {