()
| 43 | } |
| 44 | |
| 45 | setHeaderWidth () { |
| 46 | if (!this.checkHeadFixed()) { |
| 47 | return; |
| 48 | } |
| 49 | let body = this.refs.body; |
| 50 | let tr = body.querySelector('tr'); |
| 51 | if (!tr) { |
| 52 | return; |
| 53 | } |
| 54 | |
| 55 | let ths = this.refs.header.querySelectorAll('th'); |
| 56 | |
| 57 | let tds = tr.querySelectorAll('td'); |
| 58 | if (tds.length <= 1) { |
| 59 | return; |
| 60 | } |
| 61 | for (let i = 0, count = tds.length; i < count; i++) { |
| 62 | if (ths[i]) { |
| 63 | ths[i].style.width = tds[i].offsetWidth + 'px'; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | sortData (key, asc) { |
| 69 | let data = this.state.data; |
no test coverage detected