diff --git a/demo/demolist/Demo1304.js b/demo/demolist/Demo1304.js new file mode 100644 index 0000000..cb6160f --- /dev/null +++ b/demo/demolist/Demo1304.js @@ -0,0 +1,72 @@ +/** +* +* @title 表格单选,且选中行填充颜色 +* @parent 表格-单选-radio-行选中 +* @description 表格增加单选、radio 和背景色的示例。 +* Demo1304 +*/ + +import React, { Component } from "react"; +import {Button,Tooltip,Radio} from "tinper-bee"; + +import Table from "../../src"; + + + +const data = [ + { check: "ASVAL_201903280005",a: "ASVAL_201903280005", b: "小张", c: "男", d: "财务二科", key: "1" }, + { check: "ASVAL_201903200004",a: "ASVAL_201903200004", b: "小明", c: "男", d: "财务一科", key: "2" }, + { check: "ASVAL_201903120002",a: "ASVAL_201903120002", b: "小红", c: "女", d: "财务一科", key: "3" } +]; + +class Demo1304 extends Component { + + constructor(props){ + super(props); + this.state = { + data: data, + selectedRowIndex: 0, + selectedValue:"ASVAL_201903200004" + } + } + + render() { + let {selectedValue} = this.state; + let columns = [ + { title: "单选", dataIndex: "check", key: "check", width: 80,render(text, record, index){ + return( + + + ) + }}, + { title: "员工编号", dataIndex: "a", key: "a", width: 300}, + { title: "员工姓名", dataIndex: "b", key: "b", width: 500 }, + { title: "性别", dataIndex: "c", key: "c", width: 500 }, + { title: "部门", dataIndex: "d", key: "d", width: 200 } + ]; + + return ( + { + if (this.state.selectedRowIndex == index) { + return 'selected'; + } else { + return ''; + } + }} + onRowClick={(record,index,indent)=>{ + this.setState({ + selectedRowIndex: index, + selectedValue:record.check + }); + }} + title={currentData =>
员工信息统计表
} + footer={currentData =>
合计: 共{data.length}条数据
} + /> + ); + } +} + +export default Demo1304; diff --git a/src/Table.scss b/src/Table.scss index a216f89..f72aee8 100644 --- a/src/Table.scss +++ b/src/Table.scss @@ -546,8 +546,8 @@ $icon-color:#505F79; &-filter-icon{ position: absolute; width: 30px; - height: 40px ; - line-height: 40px; + height: 39px ; + line-height: 39px; right: 0px ; top:1px ; z-index: 2; diff --git a/src/lib/filterColumn.js b/src/lib/filterColumn.js index b092cbc..05b1432 100644 --- a/src/lib/filterColumn.js +++ b/src/lib/filterColumn.js @@ -102,11 +102,11 @@ export default function filterColumn(Table, Popover) { this.checkedColumItemClick(da); } } - return (