bee-table/demo/demolist/Demo1002.js

81 lines
1.9 KiB
JavaScript
Raw Normal View History

2019-04-16 13:35:25 +08:00
/**
*
* @title 拖拽改变列宽度
2019-04-18 10:50:38 +08:00
* @parent 列操作-拖拽 Drag
2019-04-22 15:44:14 +08:00
* @description onDropBorder方法为调整列宽后触发的回调函数不支持tree结构的表头合并表头的table
2019-04-16 13:35:25 +08:00
*/
import React, { Component } from 'react';
import {Icon} from "tinper-bee";
import Table from '../../src';
import dragColumn from '../../src/lib/dragColumn';
const columns23 = [
{
title: "名字",
dataIndex: "a",
key: "a",
width: '200',
fixed:'left'
},
{
title: "性别",
dataIndex: "b",
key: "b",
width: '600'
},
{
title: "年龄",
dataIndex: "c",
key: "c",
width: '200',
sumCol: true,
sorter: (a, b) => a.c - b.c
},
{
title: "武功级别",
dataIndex: "d",
key: "d",
width: 500,
}
];
const data23 = [
{ a: "杨过", b: "男", c: 30,d:'内行', key: "2" },
{ a: "令狐冲", b: "男", c: 41,d:'大侠', key: "1" },
{ 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" },
{ a: "郭靖", b: "男", c: 25,d:'大侠', key: "3" }
];
const DragColumnTable = dragColumn(Table);
const defaultProps23 = {
prefixCls: "bee-table"
};
class Demo23 extends Component {
constructor(props) {
super(props);
}
render() {
2019-04-22 15:44:14 +08:00
return <DragColumnTable
columns={columns23}
data={data23}
bordered
dragborder={true}
draggable={true}
scroll={{y:200}}
onDropBorder ={(e,width)=>{
console.log(width+"--调整列宽后触发事件",e.target);
}}
/>;
2019-04-16 13:35:25 +08:00
}
}
Demo23.defaultProps = defaultProps23;
export default Demo23;