示例还原
This commit is contained in:
parent
7bb4033427
commit
cfa6ae4165
|
@ -10,28 +10,7 @@ import Tooltip from "bee-tooltip";
|
|||
import Table from "../../src";
|
||||
import BigData from "../../src/lib/bigData";
|
||||
const BigDataTable = BigData(Table);
|
||||
|
||||
|
||||
const data = [ ...new Array(10000) ].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 = '女';
|
||||
}
|
||||
return rs;
|
||||
})
|
||||
|
||||
|
||||
class Demo30 extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const _this = this;
|
||||
this.state = {
|
||||
data: data,
|
||||
selectedRowIndex: 0,
|
||||
currentIndex:-1
|
||||
}
|
||||
this.columns = [
|
||||
const columns = [
|
||||
{
|
||||
title:'序号',
|
||||
dataIndex:'index',
|
||||
|
@ -66,59 +45,54 @@ class Demo30 extends Component {
|
|||
key: "d",
|
||||
fixed:'right',
|
||||
render(text, record, index) {
|
||||
|
||||
return (
|
||||
<div style={{ position: 'relative' }} title={text} >
|
||||
<a
|
||||
href="javascript:;"
|
||||
tooltip={text}
|
||||
onClick={() => {
|
||||
alert(record.key+'这是第' + index + '列,内容为:' + text);
|
||||
alert('这是第' + index + '列,内容为:' + text);
|
||||
}}
|
||||
>
|
||||
{record.key+'这是第' + index}
|
||||
一些操作
|
||||
</a>
|
||||
<button onClick={_this.del(record,index) }>删除</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
];
|
||||
];
|
||||
|
||||
const data = [ ...new Array(10000) ].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 = '女';
|
||||
}
|
||||
return rs;
|
||||
})
|
||||
|
||||
|
||||
class Demo30 extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
data: data,
|
||||
selectedRowIndex: 0
|
||||
}
|
||||
}
|
||||
|
||||
add=()=>{
|
||||
let {currentIndex} = this.state;
|
||||
let data = this.state.data;
|
||||
const key = data.length;
|
||||
|
||||
data.push({a: key + 'a', b: key + 'b', c: key + 'c', d: key + 'd', key: key});
|
||||
currentIndex = data.length
|
||||
this.setState({data,currentIndex});
|
||||
}
|
||||
del=(record,index)=>(record,index)=>{
|
||||
|
||||
let data = this.state.data;
|
||||
data.splice(index,1);
|
||||
|
||||
this.setState(data);
|
||||
}
|
||||
render() {
|
||||
const {currentIndex} = this.state;
|
||||
return (
|
||||
<div>
|
||||
<button onClick = {this.add}>增加</button>
|
||||
<BigDataTable
|
||||
columns={this.columns}
|
||||
columns={columns}
|
||||
data={data}
|
||||
parentNodeId='parent'
|
||||
scroll={{y:300}}
|
||||
currentIndex = {currentIndex}
|
||||
height={40}
|
||||
onRowClick={(record, index, indent) => {
|
||||
console.log('currentIndex--'+index);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue