File tree 1 file changed +17
-2
lines changed
grails-app/assets/javascripts
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 459
459
if ( $parentColumn . length ) {
460
460
var select2 = $parentColumn . find ( '.select2-container' ) ;
461
461
function calculateWidth ( ) {
462
- var columnWidth = $parentTable . width ( ) * percentageWidth / 100 ;
462
+ var parentWidth = $parentTable . width ( ) ;
463
+
464
+ // If the table has overflowed due to long selections then we need to try and find a parent div
465
+ // as the div won't have overflowed.
466
+ var windowWidth = window . innerWidth ;
467
+ if ( parentWidth > windowWidth ) {
468
+ var parent = $parentTable . parent ( 'div' ) ;
469
+ if ( parent . length ) {
470
+ parentWidth = parent . width ( ) ;
471
+ }
472
+ else {
473
+ parentWidth = windowWidth ;
474
+ }
475
+ }
476
+ var columnWidth = parentWidth * percentageWidth / 100 ;
477
+
463
478
if ( columnWidth > 10 ) {
464
479
select2 . css ( 'max-width' , columnWidth + 'px' ) ;
465
480
}
477
492
ko . utils . domNodeDisposal . addDisposeCallback ( element , function ( ) {
478
493
$ ( window ) . off ( 'resize' , resizeHandler ) ;
479
494
} ) ;
480
- setTimeout ( calculateWidth , 100 ) ;
495
+ setTimeout ( calculateWidth , 0 ) ;
481
496
}
482
497
483
498
}
You can’t perform that action at this time.
0 commit comments