bee-table/demo/demolist/Demo1601.js

72 lines
1.8 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 分页 Pagination
2019-03-20 17:44:05 +08:00
* @description 点击分页联动表格
2019-04-23 20:11:38 +08:00
* demo1601
2019-03-20 17:44:05 +08:00
*/
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
import React, { Component } from "react";
import {Pagination} from "tinper-bee";
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
import Table from "../../src";
2018-12-21 09:58:52 +08:00
2019-04-23 20:11:38 +08:00
const columns = [
{ title: "员工编号", dataIndex: "a", key: "a", width: 300, className: "rowClassName"},
{ title: "员工姓名", dataIndex: "b", key: "b", width: 500 },
{ title: "性别", dataIndex: "c", key: "c", width: 500 },
{ title: "部门", dataIndex: "d", key: "d", width: 200 }
2018-12-21 09:58:52 +08:00
];
2019-03-20 17:44:05 +08:00
const pageData = {
1: [
2019-04-23 20:11:38 +08:00
{ a: "ASVAL_201903280005", b: "小张", c: "男", d: "财务二科", key: "1" },
{ a: "ASVAL_201903200004", b: "小明", c: "男", d: "财务一科", key: "2" },
{ a: "ASVAL_201903120002", b: "小红", c: "女", d: "财务一科", key: "3" }
2019-03-20 17:44:05 +08:00
],
2: [
2019-04-23 20:11:38 +08:00
{ a: "ASVAL_201903280010", b: "小王", c: "女", d: "财务二科", key: "4" },
{ a: "ASVAL_201903200021", b: "小李", c: "男", d: "财务一科", key: "5" },
2019-03-20 17:44:05 +08:00
]
};
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
class Demo8 extends Component {
2018-12-21 09:58:52 +08:00
constructor(props) {
super(props);
this.state = {
2019-03-20 17:44:05 +08:00
data: pageData[1],
activePage: 1
};
2018-12-21 09:58:52 +08:00
}
2019-03-20 17:44:05 +08:00
handleSelect(eventKey) {
this.setState({
data: pageData[eventKey],
activePage: eventKey
2018-12-21 09:58:52 +08:00
});
}
render() {
2019-03-20 17:44:05 +08:00
return (
<div className="demo8">
2019-04-23 20:11:38 +08:00
<Table columns={columns} data={this.state.data} />
2019-03-20 17:44:05 +08:00
<Pagination
first
last
prev
next
maxButtons={5}
boundaryLinks
activePage={this.state.activePage}
onSelect={this.handleSelect.bind(this)}
onDataNumSelect={this.dataNumSelect}
showJump={true}
2019-04-25 10:03:41 +08:00
noBorder={true}
2019-03-20 17:44:05 +08:00
total={100}
dataNum={2}
/>
</div>
);
2018-12-21 09:58:52 +08:00
}
}
2019-03-20 17:44:05 +08:00
export default Demo8;