File tree 1 file changed +9
-4
lines changed
grails-app/assets/javascripts
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 460
460
var select2 = $parentColumn . find ( '.select2-container' ) ;
461
461
function calculateWidth ( ) {
462
462
var columnWidth = $parentTable . width ( ) * percentageWidth / 100 ;
463
- select2 . css ( 'max-width' , columnWidth + 'px' ) ;
463
+ if ( columnWidth > 10 ) {
464
+ select2 . css ( 'max-width' , columnWidth + 'px' ) ;
465
+ }
466
+ else {
467
+ // The table is not visible yet, so wait a bit and try again.
468
+ setTimeout ( calculateWidth , 200 ) ;
469
+ }
464
470
}
465
- var debounce = null ;
466
471
resizeHandler = function ( ) {
467
- clearTimeout ( debounce ) ;
472
+ clearTimeout ( calculateWidth ) ;
468
473
setTimeout ( calculateWidth , 300 ) ;
469
474
} ;
470
475
$ ( window ) . on ( 'resize' , resizeHandler ) ;
471
476
472
477
ko . utils . domNodeDisposal . addDisposeCallback ( element , function ( ) {
473
478
$ ( window ) . off ( 'resize' , resizeHandler ) ;
474
479
} ) ;
475
- resizeHandler ( ) ;
480
+ setTimeout ( calculateWidth , 100 ) ;
476
481
}
477
482
478
483
}
You can’t perform that action at this time.
0 commit comments