nl_tokens: automatically add a colgroup with col elements set to a percentage width
pl_tokens: function ( table ) { table = $ ( table ) [ 0 ] ; var overallWidth , percent , $tbodies , len , index , c = table . config , $colgroup = c . $table . children ( 'colgroup' ) ; // remove plugin-added colgroup, in case we need to refresh the widths if ( $colgroup . length && $colgroup . hasClass ( <mask> . css . colgroup ) ) { $colgroup . remove ( ) ; } if ( c . widthFixed && c . $table . children ( 'colgroup' ) . length === 0 ) { $colgroup = $ ( '<colgroup class="' + ts . css . colgroup + '">' ) ; overallWidth = c . $table . width ( ) ; // only add col for visible columns - fixes #371 $tbodies = c . $tbodies . find ( 'tr:first' ) . children ( ':visible' ) ; len = $tbodies . length ; for ( index = 0 ; index < len ; index ++ ) { percent = parseInt ( ( $tbodies . eq ( index ) . width ( ) / overallWidth ) * 1000 , 10 ) / 10 + '%' ; $colgroup . append ( $ ( '<col>' ) . css ( 'width' , percent ) ) ; } c . $table . prepend ( $colgroup ) ; } }