fix:滚动加载场景,更新数据源,表体显示空白问题
This commit is contained in:
parent
b1ba5b5001
commit
57f742014a
|
@ -83,10 +83,10 @@ function bigData(Table) {
|
|||
_this.startIndex = _this.currentIndex; //数据开始位置
|
||||
_this.endIndex = _this.currentIndex + _this.loadCount; //数据结束位置
|
||||
}
|
||||
if (nextProps.data !== props.data) {
|
||||
//wh fix: 滚动加载场景中,数据动态改变下占位计算错误的问题(26 Jun)
|
||||
// _this.cachedRowHeight = []; //缓存每行的高度
|
||||
// _this.cachedRowParentIndex = [];
|
||||
if (nextProps.data.toString() !== props.data.toString()) {
|
||||
//fix: 滚动加载场景中,数据动态改变下占位计算错误的问题(26 Jun)
|
||||
_this.cachedRowHeight = []; //缓存每行的高度
|
||||
_this.cachedRowParentIndex = [];
|
||||
_this.computeCachedRowParentIndex(nextProps.data);
|
||||
if (nextProps.data.length > 0) {
|
||||
_this.endIndex = _this.currentIndex - nextProps.loadBuffer + _this.loadCount; //数据结束位置
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import {Button,Tooltip} from "tinper-bee";
|
||||
import Table from "../../src";
|
||||
|
||||
const columns = [
|
||||
|
|
|
@ -62,16 +62,26 @@ class Demo30 extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
handleClick = () => {
|
||||
this.setState({
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<button onClick={this.handleClick}>更新data</button>
|
||||
<BigDataTable
|
||||
columns={columns}
|
||||
data={data}
|
||||
data={this.state.data}
|
||||
scroll={{y:300}}
|
||||
onRowClick={(record, index, indent) => {
|
||||
console.log('currentIndex--'+index);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
|
|
@ -13,16 +13,54 @@ import BigData from "../../src/lib/bigData";
|
|||
import multiSelect from '../../src/lib/multiSelect';
|
||||
import filterColumn from '../../src/lib/filterColumn';
|
||||
|
||||
let ComplexTable = filterColumn(multiSelect(BigData(Table), Checkbox), Popover, Icon);
|
||||
let ComplexTable = filterColumn(BigData(Table), Popover, Icon);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
className: 'u-table-multiSelect-column',
|
||||
title: (
|
||||
<Checkbox
|
||||
className="table-checkbox"
|
||||
/>
|
||||
),
|
||||
key: "checkbox",
|
||||
dataIndex: "checkbox",
|
||||
fixed:"left",
|
||||
width: 49,
|
||||
render: (text, record, index) => {
|
||||
const obj = {
|
||||
children: <Checkbox
|
||||
key={index}
|
||||
className="table-checkbox"
|
||||
/>,
|
||||
props: {},
|
||||
};
|
||||
if (index % 50 === 0) {
|
||||
obj.props.rowSpan = 50;
|
||||
} else {
|
||||
obj.props.rowSpan = 0;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
{
|
||||
title:'序号',
|
||||
dataIndex:'index',
|
||||
width:'80',
|
||||
key:'index',
|
||||
fixed:'left',
|
||||
render:(text,record,index)=>{
|
||||
return index
|
||||
// return index
|
||||
const obj = {
|
||||
children: index,
|
||||
props: {},
|
||||
};
|
||||
if (index % 50 === 0) {
|
||||
obj.props.rowSpan = 50;
|
||||
} else {
|
||||
obj.props.rowSpan = 0;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -46,7 +84,7 @@ const columns = [
|
|||
{ title: "年龄", dataIndex: "c", key: "c", width: 200 }
|
||||
];
|
||||
|
||||
const data = [ ...new Array(10000) ].map((e, i) => {
|
||||
const data = [ ...new Array(150) ].map((e, i) => {
|
||||
const rs = { a: i + 'a', b: i + 'b', c: i + 'c', d: i + 'd', key: i };
|
||||
if(i%3==0){
|
||||
rs.b = '女';
|
||||
|
|
|
@ -68,7 +68,7 @@ class DemoGroup extends Component {
|
|||
render () {
|
||||
return (
|
||||
<Row>
|
||||
{DemoArray.map((child,index) => {
|
||||
{[DemoArray[39]].map((child,index) => {
|
||||
|
||||
return (
|
||||
<Demo example= {child.example} title= {child.title} code= {child.code} scss_code= {child.scss_code} desc= {child.desc} key= {index}/>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -291,7 +291,7 @@
|
|||
.u-table-fixed-left .u-table-body-inner {
|
||||
margin-right: -20px;
|
||||
padding-right: 20px; }
|
||||
.u-table-fixed-header .u-table-fixed-left .u-table-body-inner {
|
||||
.u-table-fixed-header:not(.u-table-hide-header) .u-table-fixed-left .u-table-body-inner {
|
||||
padding-right: 0px; }
|
||||
.u-table-fixed-header .u-table-body-inner {
|
||||
height: 100%;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "2.1.14",
|
||||
"version": "2.1.15-beta.1",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
|
@ -60,10 +60,10 @@ export default function bigData(Table) {
|
|||
_this.endIndex = _this.currentIndex + _this.loadCount; //数据结束位置
|
||||
|
||||
}
|
||||
if (nextProps.data !== props.data) {
|
||||
//wh fix: 滚动加载场景中,数据动态改变下占位计算错误的问题(26 Jun)
|
||||
// _this.cachedRowHeight = []; //缓存每行的高度
|
||||
// _this.cachedRowParentIndex = [];
|
||||
if (nextProps.data.toString() !== props.data.toString()) {
|
||||
//fix: 滚动加载场景中,数据动态改变下占位计算错误的问题(26 Jun)
|
||||
_this.cachedRowHeight = []; //缓存每行的高度
|
||||
_this.cachedRowParentIndex = [];
|
||||
_this.computeCachedRowParentIndex(nextProps.data);
|
||||
if(nextProps.data.length>0){
|
||||
_this.endIndex = _this.currentIndex - nextProps.loadBuffer + _this.loadCount; //数据结束位置
|
||||
|
|
Loading…
Reference in New Issue