bee-table/demo/demolist/Demo11.js

77 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-12-21 09:58:52 +08:00
/**
*
2019-03-20 17:44:05 +08:00
* @title 拖拽列宽度
* @description 不支持tree结构的表头合并表头的table
2018-12-21 09:58:52 +08:00
*/
import React, { Component } from 'react';
2019-03-19 11:13:10 +08:00
import {Icon} from "tinper-bee";
2019-03-20 17:44:05 +08:00
import Table from '../../src';
import dragColumn from '../../src/lib/dragColumn';
const columns23 = [
2018-12-21 09:58:52 +08:00
{
title: "名字",
dataIndex: "a",
key: "a",
2019-03-20 17:44:05 +08:00
width: '200',
fixed:'left'
2018-12-21 09:58:52 +08:00
},
{
title: "性别",
dataIndex: "b",
key: "b",
2019-03-20 17:44:05 +08:00
width: '600'
2018-12-21 09:58:52 +08:00
},
{
title: "年龄",
dataIndex: "c",
key: "c",
2019-03-20 17:44:05 +08:00
width: '200',
sumCol: true,
2018-12-21 09:58:52 +08:00
sorter: (a, b) => a.c - b.c
2019-03-20 17:44:05 +08:00
},
2018-12-21 09:58:52 +08:00
{
title: "武功级别",
dataIndex: "d",
2019-03-20 17:44:05 +08:00
key: "d",
width: 500,
2018-12-21 09:58:52 +08:00
}
];
2019-03-20 17:44:05 +08:00
const data23 = [
2018-12-21 09:58:52 +08:00
{ a: "杨过", b: "男", c: 30,d:'内行', key: "2" },
{ a: "令狐冲", b: "男", c: 41,d:'大侠', key: "1" },
2019-03-20 17:44:05 +08:00
{ a: "郭靖", b: "男", c: 25,d:'大侠', key: "31" } , { a: "杨过", b: "男", c: 30,d:'内行', key: "21" },
{ a: "令狐冲", b: "男", c: 41,d:'大侠', key: "11" },
{ a: "郭靖", b: "男", c: 25,d:'大侠', key: "32" } , { a: "杨过", b: "男", c: 30,d:'内行', key: "22" },
{ a: "令狐冲", b: "男", c: 41,d:'大侠', key: "12" },
2018-12-21 09:58:52 +08:00
{ a: "郭靖", b: "男", c: 25,d:'大侠', key: "3" }
];
2019-03-20 17:44:05 +08:00
const DragColumnTable = dragColumn(Table);
const defaultProps23 = {
2018-12-21 09:58:52 +08:00
prefixCls: "bee-table"
};
2019-03-20 17:44:05 +08:00
class Demo23 extends Component {
2018-12-21 09:58:52 +08:00
constructor(props) {
2019-03-20 17:44:05 +08:00
super(props);
2018-12-21 09:58:52 +08:00
}
2019-03-20 17:44:05 +08:00
render() {
return <DragColumnTable columns={columns23} data={data23} bordered
dragborder={true}
draggable={true}
scroll={{y:200}}
onDropBorder ={(e,width)=>{
console.log(width+"--调整列宽后触发事件",e.target);
}}
/>;
2018-12-21 09:58:52 +08:00
}
}
2019-03-20 17:44:05 +08:00
Demo23.defaultProps = defaultProps23;
2018-12-21 09:58:52 +08:00
2019-03-20 17:44:05 +08:00
export default Demo23;