diff --git a/src/components/gird/main.css b/src/components/gird/main.css index a9b16488..9cca838d 100644 --- a/src/components/gird/main.css +++ b/src/components/gird/main.css @@ -61,6 +61,12 @@ display: flex; } +.tr.active{ + + background-color: #ebf2f7 !important; + +} + .tfoot { width: 100%; height: auto; diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 072ee9b1..edf6346e 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -118,6 +118,7 @@ export default class menu extends React.Component { ], emptyText: "抱歉,暂无相关数据记录", dataCount:23, + curIndex:0, } @@ -162,22 +163,27 @@ export default class menu extends React.Component { scrollFunc = function (e) { - e = e || window.event; - if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件 - if (e.wheelDelta > 0) { //当滑轮向上滚动时 - - } - if (e.wheelDelta < 0) { //当滑轮向下滚动时 - - } - } else if (e.detail) { //Firefox滑轮事件 - if (e.detail> 0) { //当滑轮向下滚动时 - - } - if (e.detail< 0) { //当滑轮向上滚动时 - - } - } + + // let grid = document.getElementById("grid"); + // console.log("当前表格") + // console.log(grid.offsetWidth) + + // e = e || window.event; + // if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件 + // if (e.wheelDelta > 0) { //当滑轮向上滚动时 + // grid.scrollTo(grid.offsetWidth,0) + // } + // if (e.wheelDelta < 0) { //当滑轮向下滚动时 + // grid.scrollTo(0,0) + // } + // } else if (e.detail) { //Firefox滑轮事件 + // if (e.detail> 0) { //当滑轮向下滚动时 + // grid.scrollTo(grid.offsetWidth,0) + // } + // if (e.detail< 0) { //当滑轮向上滚动时 + // grid.scrollTo(0,0) + // } + // } } @@ -185,6 +191,9 @@ export default class menu extends React.Component { componentDidMount() { const dom = ReactDom.findDOMNode(this); + console.log("表格") + + if(dom.attachEvent){ dom.attachEvent('onmousewheel',this.scrollFunc); @@ -374,6 +383,11 @@ export default class menu extends React.Component { return selectList } + rowItemClick(index){ + console.log(index) + + this.setState({curIndex:index}) + } render() { @@ -388,7 +402,7 @@ export default class menu extends React.Component { - return (
+ return (
{ this.props.isMultiple ? ( < div className = "th-td" style = { @@ -470,7 +484,7 @@ export default class menu extends React.Component { this.state.emptyText } < /div>): ( this.state.tableData.map((item, index) => { - return (
{this.rowItemClick(index)}} style = { { "background": index % 2 == 0 ? this.props.spliteColor : "#ffffff"