@@ -35,6 +35,7 @@ export default class BrowserTable extends React.Component {
35
35
this . tableRef = React . createRef ( ) ;
36
36
this . handleResize = this . handleResize . bind ( this ) ;
37
37
this . updateMaxWidth = this . updateMaxWidth . bind ( this ) ;
38
+ this . headerWidth = 34 ;
38
39
}
39
40
40
41
componentWillReceiveProps ( props ) {
@@ -121,10 +122,16 @@ export default class BrowserTable extends React.Component {
121
122
let editor = null ;
122
123
let table = < div ref = { this . tableRef } /> ;
123
124
if ( this . props . data ) {
124
- const rowWidth = this . props . order . reduce (
125
+ let rowWidth = this . props . order . reduce (
125
126
( rowWidth , { visible, width } ) => ( visible ? rowWidth + width : rowWidth ) ,
126
127
this . props . onAddRow ? 210 : 0
127
128
) + 30 ;
129
+
130
+ this . headerWidth = Math . max (
131
+ 30 ,
132
+ Math . floor ( Math . log10 ( this . props . data . length + this . props . skip ) ) * 10
133
+ ) + 4 ;
134
+
128
135
let editCloneRows ;
129
136
if ( this . props . editCloneRows ) {
130
137
editCloneRows = (
@@ -159,6 +166,7 @@ export default class BrowserTable extends React.Component {
159
166
row = { index + this . props . skip }
160
167
rowValue = { this . props . data [ index ] }
161
168
rowWidth = { rowWidth }
169
+ headerWidth = { this . headerWidth }
162
170
selection = { this . props . selection }
163
171
selectRow = { this . props . selectRow }
164
172
setCurrent = { this . props . setCurrent }
@@ -240,6 +248,7 @@ export default class BrowserTable extends React.Component {
240
248
readOnlyFields = { READ_ONLY }
241
249
row = { - 1 }
242
250
rowWidth = { rowWidth }
251
+ headerWidth = { this . headerWidth }
243
252
selection = { this . props . selection }
244
253
selectRow = { this . props . selectRow }
245
254
setCurrent = { this . props . setCurrent }
@@ -332,6 +341,7 @@ export default class BrowserTable extends React.Component {
332
341
row = { i + this . props . skip }
333
342
rowValue = { this . props . data [ i ] }
334
343
rowWidth = { rowWidth }
344
+ headerWidth = { this . headerWidth }
335
345
selection = { this . props . selection }
336
346
selectRow = { this . props . selectRow }
337
347
setCurrent = { this . props . setCurrent }
@@ -563,6 +573,7 @@ export default class BrowserTable extends React.Component {
563
573
isDataLoaded = { ! this . props . isLoading }
564
574
setSelectedObjectId = { this . props . setSelectedObjectId }
565
575
setCurrent = { this . props . setCurrent }
576
+ headerWidth = { this . headerWidth }
566
577
/>
567
578
{ table }
568
579
</ div >
0 commit comments