@@ -617,16 +617,7 @@ const setResizeListener = table => {
617617 }
618618 tableEl . setAttribute ( 'style' , `width: ${ width } px;` )
619619
620- if ( table . options . showColumnWidthTooltip ) {
621- const tip = bootstrap . Tooltip . getInstance ( col ) ;
622- if ( tip && tip . _isShown ( ) ) {
623- const inner = tip . tip . querySelector ( '.tooltip-inner' ) ;
624- const tipText = getColumnTooltipTitle ( table . options , colWidth + marginX ) ;
625- inner . innerHTML = tipText ;
626- tip . _config . title = tipText ;
627- tip . update ( ) ;
628- }
629- }
620+ resetColumnWidthTips ( table , col ) ;
630621
631622 const header = col . parentElement ;
632623 if ( header . classList . contains ( 'fixed' ) ) {
@@ -680,13 +671,26 @@ const resizeNextFixedColumnWidth = (col, width) => {
680671 }
681672}
682673
674+ const resetColumnWidthTips = ( table , col ) => {
675+ if ( table . options . showColumnWidthTooltip ) {
676+ const tip = bootstrap . Tooltip . getInstance ( col ) ;
677+ if ( tip && tip . _isShown ( ) ) {
678+ const inner = tip . tip . querySelector ( '.tooltip-inner' ) ;
679+ const tipText = getColumnTooltipTitle ( table . options , col . closest ( 'th' ) ) ;
680+ inner . innerHTML = tipText ;
681+ tip . _config . title = tipText ;
682+ tip . update ( ) ;
683+ }
684+ }
685+ }
686+
683687const setColumnResizingListen = ( table , col ) => {
684688 if ( table . options . showColumnWidthTooltip ) {
685689 EventHandler . on ( col , 'mouseenter' , e => {
686690 closeAllTips ( table . columns , e . target ) ;
687691 const th = col . closest ( 'th' ) ;
688692 const tip = bootstrap . Tooltip . getOrCreateInstance ( e . target , {
689- title : getColumnTooltipTitle ( table . options , th . offsetWidth ) ,
693+ title : getColumnTooltipTitle ( table . options , th ) ,
690694 trigger : 'manual' ,
691695 placement : 'top' ,
692696 customClass : 'table-resizer-tips'
@@ -698,8 +702,8 @@ const setColumnResizingListen = (table, col) => {
698702 }
699703}
700704
701- const getColumnTooltipTitle = ( options , width ) => {
702- return `${ options . columnWidthTooltipPrefix } ${ width } px` ;
705+ const getColumnTooltipTitle = ( options , th ) => {
706+ return `${ options . columnWidthTooltipPrefix } ${ th . offsetWidth } px` ;
703707}
704708
705709const indexOfCol = col => {
@@ -742,6 +746,12 @@ const autoFitColumnWidth = async (table, col) => {
742746 } ) ;
743747
744748 setTableDefaultWidth ( table ) ;
749+
750+ if ( table . options . resizeColumnCallback ) {
751+ await table . invoke . invokeMethodAsync ( table . options . resizeColumnCallback , index , maxWidth )
752+ }
753+
754+ resetColumnWidthTips ( table , col ) ;
745755 }
746756}
747757
0 commit comments