bee-table/demo/demolist/Demo23.js

67 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-05-02 19:26:44 +08:00
/**
*
2018-09-26 16:36:49 +08:00
* @title 拖拽调整列的宽度
* @description 不支持tree结构的表头不支持和表头拖拽交互列一起使用
2018-05-02 19:26:44 +08:00
*/
import React, { Component } from 'react';
2018-05-08 16:41:14 +08:00
import Table from '../../src';
2018-05-07 10:58:24 +08:00
import dragColumn from '../../src/lib/dragColumn';
2018-05-11 09:29:43 +08:00
2018-05-02 19:26:44 +08:00
import Icon from "bee-icon";
2018-05-11 09:29:43 +08:00
const columns23 = [
2018-05-02 19:26:44 +08:00
{
title: "名字",
dataIndex: "a",
key: "a",
width: 100
},
{
title: "性别",
dataIndex: "b",
key: "b",
2018-05-11 09:29:43 +08:00
width: 200
2018-05-02 19:26:44 +08:00
},
{
title: "年龄",
dataIndex: "c",
key: "c",
width: 200,
2018-05-04 14:31:24 +08:00
sumCol: true,
2018-05-02 19:26:44 +08:00
sorter: (a, b) => a.c - b.c
},
{
title: "武功级别",
dataIndex: "d",
2018-05-11 09:29:43 +08:00
key: "d",
width: 200,
2018-05-02 19:26:44 +08:00
}
];
2018-05-11 09:29:43 +08:00
const data23 = [
2018-05-02 19:26:44 +08:00
{ a: "杨过", b: "男", c: 30,d:'内行', key: "2" },
{ a: "令狐冲", b: "男", c: 41,d:'大侠', key: "1" },
{ a: "郭靖", b: "男", c: 25,d:'大侠', key: "3" }
];
2018-05-08 16:41:14 +08:00
const DragColumnTable = dragColumn(Table);
2018-05-02 19:26:44 +08:00
2018-05-11 09:29:43 +08:00
const defaultProps23 = {
2018-05-02 19:26:44 +08:00
prefixCls: "bee-table"
};
2018-05-11 09:29:43 +08:00
class Demo23 extends Component {
2018-05-02 19:26:44 +08:00
constructor(props) {
2018-05-11 09:29:43 +08:00
super(props);
2018-05-02 19:26:44 +08:00
}
2018-05-11 11:30:56 +08:00
2018-05-02 19:26:44 +08:00
render() {
2018-05-11 09:29:43 +08:00
return <DragColumnTable columns={columns23} data={data23} bordered
2018-09-13 10:28:28 +08:00
dragborder={true}
2018-05-11 09:29:43 +08:00
/>;
2018-05-02 19:26:44 +08:00
}
}
2018-05-11 09:29:43 +08:00
Demo23.defaultProps = defaultProps23;
2018-05-02 19:26:44 +08:00
2018-05-11 09:29:43 +08:00
export default Demo23;