bee-table/demo/demolist/Demo1002.js

76 lines
1.6 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-23 20:11:38 +08:00
* demo1002
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 = [
{
2019-04-24 14:15:59 +08:00
title: "订单编号",
2019-04-16 13:35:25 +08:00
dataIndex: "a",
key: "a",
width: '200',
fixed:'left'
},
{
2019-04-24 14:15:59 +08:00
title: "单据日期",
2019-04-16 13:35:25 +08:00
dataIndex: "b",
key: "b",
width: '600'
},
{
2019-04-24 14:15:59 +08:00
title: "供应商",
2019-04-16 13:35:25 +08:00
dataIndex: "c",
key: "c",
width: '200',
},
{
2019-04-24 14:15:59 +08:00
title: "联系人",
2019-04-16 13:35:25 +08:00
dataIndex: "d",
key: "d",
width: 500,
}
];
const data23 = [
2019-04-24 14:15:59 +08:00
{ a: "NU0391001", b: "2019-03-01", c: "xx供应商",d:'Tom', key: "2" },
{ a: "NU0391002", b: "2018-11-02", c: "yy供应商",d:'Jack', key: "1" },
{ a: "NU0391003", b: "2019-05-03", c: "zz供应商",d:'Jane', key: "3" }
2019-04-16 13:35:25 +08:00
];
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;