File tree 1 file changed +8
-5
lines changed
packages/react-data-grid/src
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ class HeaderCell extends React.Component {
33
33
34
34
state = { resizing : false } ;
35
35
36
+ headerCellRef = ( node ) => this . headerCell = node ;
37
+
36
38
onDragStart = ( e ) => {
37
39
this . setState ( { resizing : true } ) ;
38
40
// need to set dummy data for FF
@@ -56,8 +58,8 @@ class HeaderCell extends React.Component {
56
58
} ;
57
59
58
60
getWidthFromMouseEvent = ( e ) => {
59
- let right = e . pageX || ( e . touches && e . touches [ 0 ] && e . touches [ 0 ] . pageX ) || ( e . changedTouches && e . changedTouches [ e . changedTouches . length - 1 ] . pageX ) ;
60
- let left = ReactDOM . findDOMNode ( this ) . getBoundingClientRect ( ) . left ;
61
+ const right = e . pageX || ( e . touches && e . touches [ 0 ] && e . touches [ 0 ] . pageX ) || ( e . changedTouches && e . changedTouches [ e . changedTouches . length - 1 ] . pageX ) ;
62
+ const left = this . headerCell ? this . headerCell . getBoundingClientRect ( ) . left : 0 ;
61
63
return right - left ;
62
64
} ;
63
65
@@ -118,7 +120,7 @@ class HeaderCell extends React.Component {
118
120
'react-grid-HeaderCell--frozen' : columnUtils . isFrozen ( column )
119
121
} , this . props . className , column . cellClass ) ;
120
122
const cell = (
121
- < div className = { className } style = { this . getStyle ( ) } >
123
+ < div ref = { this . headerCellRef } className = { className } style = { this . getStyle ( ) } >
122
124
{ this . getCell ( ) }
123
125
{ resizeHandle }
124
126
</ div >
@@ -129,8 +131,9 @@ class HeaderCell extends React.Component {
129
131
return (
130
132
< DraggableHeaderCell
131
133
column = { column }
132
- onHeaderDrop = { this . props . onHeaderDrop } >
133
- { cell }
134
+ onHeaderDrop = { this . props . onHeaderDrop }
135
+ >
136
+ { cell }
134
137
</ DraggableHeaderCell >
135
138
) ;
136
139
}
You can’t perform that action at this time.
0 commit comments