React 表格行点击事件
<Table dataSource={this.dataSources} columns={this.columns} onRow={(record) => {//表格行点击事件 return { // onClick: this.clickRow.bind(this,record), onMouseEnter: this.clickRows.bind(this,record), onMouseLeave: this.clickRowss.bind(this,record) }; }} onHeaderRow={(column, index) => {//表格行点击事件 return { // onClick: this.clickRow.bind(this,record), onMouseEnter: this.clickRowsss.bind(this,column, index), onMouseLeave: this.clickRowssss.bind(this,column, index) }; }} // bordered pagination={{ // current: 1, current: this.state.pages, //当前页数 改变这个 就在改变页 defaultCurrent: 1, //默认的当前页数 pageSize: 20, // defaultPageSize: 1, onChange: this.onchange.bind(this), hideOnSinglePage: true }} // style = { display = this.state.cloudSource } className="cloudSourceAudit tablessa" /> // --------------------------------------------------------------------- clickRows(record){ document.getElementsByClassName(‘ant-table-row-level-0‘)[record[‘key‘]-1].style.background = ‘#516563‘; // document.getElementsByClassName(‘ant-table-thead‘)[0].style.background = ‘#516563‘; } clickRowss(record){ document.getElementsByClassName(‘ant-table-row-level-0‘)[record[‘key‘]-1].style.background = ‘transparent‘; // document.getElementsByClassName(‘ant-table-thead‘)[0].style.background = ‘transparent‘; } clickRowsss(record,index){ //头部 document.getElementsByClassName(‘ant-table-thead‘)[0].style.background = ‘#516563‘; document.getElementsByClassName(‘ant-table-thead‘)[1].style.background = ‘#516563‘; } clickRowssss(record,index){ document.getElementsByClassName(‘ant-table-thead‘)[0].style.background = ‘transparent‘; document.getElementsByClassName(‘ant-table-thead‘)[1].style.background = ‘transparent‘; } clickRowsssss(record,index){ // console.log("我是5",record,index,$(‘#tableId‘)) // document.getElementsByClassName(‘ant-table-row-level-0‘)[0].style.background = ‘red‘; // document.getElementsByClassName(‘ant-table-row-level-0‘)[1].style.background = ‘red‘; for(var i=0; i<document.getElementsByClassName(‘ant-table-row-level-0‘).length; i++){ document.getElementsByClassName(‘ant-table-row-level-0‘)[i].style.background = ‘transparent‘; } document.getElementsByClassName(‘ant-table-row-level-0‘)[record[‘key‘]-1].style.background = ‘#516563‘; // console.log(document.getElementsByClassName(‘ant-table-row-level-0‘),"测试",$(‘.ant-table-row-level-0‘)[record[‘key‘]-1]) // this.setState({ // rowId: record.key, // }); // $(‘.ant-table-row-level-0‘)[record[‘key‘]-1].siblings().style.background = ‘red‘; }
相关推荐
游走的豚鼠君 2020-11-10
81417707 2020-10-30
ctg 2020-10-14
小飞侠V 2020-09-25
PncLogon 2020-09-24
jipengx 2020-09-10
颤抖吧腿子 2020-09-04
wwzaqw 2020-09-04
maple00 2020-09-02
青蓝 2020-08-26
罗忠浩 2020-08-16
liduote 2020-08-13
不知道该写啥QAQ 2020-08-02
pengruiyu 2020-08-01
wmd看海 2020-07-27
孝平 2020-07-18
Eduenth 2020-07-05
iftrueIloveit 2020-07-04