2017-09-14 15:45:18 +08:00
|
|
|
/**
|
|
|
|
*
|
2017-09-18 15:18:42 +08:00
|
|
|
* @title 列排序、全选功能
|
|
|
|
* @description 列排序、全选功能
|
2017-09-14 15:45:18 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React, { Component } from "react";
|
|
|
|
import Table from "../../src";
|
|
|
|
import Checkbox from "bee-checkbox";
|
2017-09-18 15:18:42 +08:00
|
|
|
import multiSelectFunc from "../../src/lib/multiSelectFunc.js";
|
|
|
|
import sortFunc from "../../src/lib/sortFunc.js";
|
2017-09-14 15:45:18 +08:00
|
|
|
|
|
|
|
const columns13 = [
|
|
|
|
{
|
|
|
|
title: "名字",
|
|
|
|
dataIndex: "a",
|
|
|
|
key: "a",
|
|
|
|
width: 100
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "性别",
|
|
|
|
dataIndex: "b",
|
|
|
|
key: "b",
|
|
|
|
width: 100
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "年龄",
|
|
|
|
dataIndex: "c",
|
|
|
|
key: "c",
|
|
|
|
width: 200,
|
|
|
|
sorter: (a, b) => a.c - b.c
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "操作",
|
|
|
|
dataIndex: "",
|
|
|
|
key: "d",
|
|
|
|
render() {
|
|
|
|
return <a href="#">一些操作</a>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
const data13 = [
|
|
|
|
{ a: "杨过", b: "男", c: 30, key: "2" },
|
|
|
|
{ a: "令狐冲", b: "男", c: 41, key: "1" },
|
|
|
|
{ a: "郭靖", b: "男", c: 25, key: "3" }
|
|
|
|
];
|
|
|
|
class Demo13 extends Component {
|
2017-09-18 15:18:42 +08:00
|
|
|
getSelectedDataFunc = (data) =>{
|
2017-09-14 15:45:18 +08:00
|
|
|
console.log(data)
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
let multiObj = {
|
|
|
|
type: "checkbox",
|
|
|
|
param: "key"
|
|
|
|
};
|
2017-09-18 15:18:42 +08:00
|
|
|
let ComplexTable = multiSelectFunc(sortFunc(Table));
|
2017-09-14 15:45:18 +08:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<ComplexTable
|
|
|
|
columns={columns13}
|
|
|
|
data={data13}
|
|
|
|
multiSelect={multiObj}
|
2017-09-18 15:18:42 +08:00
|
|
|
getSelectedDataFunc={this.getSelectedDataFunc}
|
2017-09-14 15:45:18 +08:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
export default Demo13;
|