ExtraLongTable
ExtraLongTable copied to clipboard
感谢大神给的思路,解决了我的大问题之二
大神的操作很六,虚拟滚动大法保平安。 继楼上的问题,发现个新问题IE下第三屏滚动会出现白屏,经测试发现ie下 删除手动赋值滚动条位置的逻辑即可。
if (type === "top") {
this.showTableList.splice(this.loadedNum - bottomNum, bottomNum); //减去底部数据
for (var i = 1; i <= topNum; i++) {
//加上顶部数据
let indexNum = topPosition - i;
this.showTableList.unshift(this.tableList[indexNum]);
}
this.loadedNum = this.loadedNum + topNum - bottomNum; //重新计算实际渲染数据条数
this.dataTop = this.dataTop - topNum * this.tdHeight; //重新计算渲染数据的高度
// 非IE浏览器手动设置一下scrollTop
**if(!this.IE_MODE){
document.getElementById("bottomDiv").scrollTop =
document.getElementById("bottomDiv").scrollTop +
bottomNum * this.tdHeight;
}**
this.scrollTop = document.getElementById("bottomDiv").scrollTop;
} else if (type == "bottom") {
this.showTableList.splice(0, topNum); //减去顶部数据
for (var i = 0; i < bottomNum; i++) {
//加上底部数据
let indexNum = topPosition + this.loadedNum + i;
this.showTableList.push(this.tableList[indexNum]);
}
this.loadedNum = this.loadedNum - topNum + bottomNum; //重新计算实际渲染数据条数
this.dataTop = this.dataTop + topNum * this.tdHeight; //重新计算渲染数据的高度
// 非IE浏览器手动设置一下scrollTop
**if(!this.IE_MODE){
document.getElementById("bottomDiv").scrollTop =
document.getElementById("bottomDiv").scrollTop -
topNum * this.tdHeight;
}**
this.scrollTop = document.getElementById("bottomDiv").scrollTop;
}