bee-table/demo/demolist/Demo1403.js

91 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-12-21 09:58:52 +08:00
/**
*
2019-03-20 17:44:05 +08:00
* @title 多功能表格滚动加载
2019-04-18 10:50:38 +08:00
* @parent 无限滚动 Infinite-scroll
2019-03-20 17:44:05 +08:00
* @description
2019-04-23 20:11:38 +08:00
* demo1403
2018-12-21 09:58:52 +08:00
*/
2019-03-20 17:44:05 +08:00
import React, { Component } from "react";
import {Tooltip,Checkbox,Icon,Popover} from "tinper-bee";
import Table from "../../src";
import BigData from "../../src/lib/bigData";
import multiSelect from '../../src/lib/multiSelect';
import filterColumn from '../../src/lib/filterColumn';
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
let ComplexTable = filterColumn(multiSelect(BigData(Table), Checkbox), Popover, Icon);
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
const columns = [
{
title:'序号',
dataIndex:'index',
width:'80',
2019-03-20 17:44:05 +08:00
key:'index',
render:(text,record,index)=>{
return index
}
},
{
title: "用户名", dataIndex: "a", key: "a", width: 580, className: "rowClassName",
render: (text, record, index) => {
return (
<Tooltip inverse overlay={text}>
<span tootip={text} style={{
2019-04-25 14:12:43 +08:00
display: "block",
2019-03-20 17:44:05 +08:00
width: "80px",
textOverflow: "ellipsis",
overflow: "hidden",
whiteSpace: "nowrap",
2019-04-25 14:12:43 +08:00
verticalAlign: "bottom",
2019-03-20 17:44:05 +08:00
}}>{text}</span>
</Tooltip>
);
2018-12-21 09:58:52 +08:00
}
},
2019-03-20 17:44:05 +08:00
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 80},
{ title: "年龄", dataIndex: "c", key: "c", width: 200 }
2018-12-21 09:58:52 +08:00
];
2019-03-20 17:44:05 +08:00
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;
})
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
class Demo32 extends Component {
constructor(props) {
super(props);
2018-12-21 09:58:52 +08:00
this.state = {
2019-03-20 17:44:05 +08:00
data: data,
selectedRowIndex: 0
2018-12-21 09:58:52 +08:00
}
}
2019-03-20 17:44:05 +08:00
getSelectedDataFunc = data => {
console.log(data);
};
2018-12-21 09:58:52 +08:00
render() {
2019-03-20 17:44:05 +08:00
return (
<ComplexTable
columns={columns}
data={data}
parentNodeId='parent'
scroll={{y:300}}
2018-12-21 09:58:52 +08:00
bordered
2019-03-20 17:44:05 +08:00
onRowClick={(record, index, indent) => {
this.setState({
selectedRowIndex: index
});
}}
getSelectedDataFunc={this.getSelectedDataFunc}/>
);
2018-12-21 09:58:52 +08:00
}
}
2019-03-20 17:44:05 +08:00
export default Demo32;