Click here to Skip to main content
15,888,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Here is my structure
<div>// this represent container of th as div
 <div> // row
  <div>div header</div> //data
 </div>
</div>


<div>
 <table>
  <tbody>
   <tr>
    <td>data has to match</td>
   </tr>
  </tbody>
 </table>
</div>


i has to match td width to header with or header with do td width, original table td follows table's corresponding th but i cant do th for reasons example:fixed

dont say use plugin

thank you i all post my
jsfiddle
for full html

What I have tried:

i tried very dull script like this but its not good so

$(cont).find('.fixedheaderHolder').children('div').each(function(){
          let height = $(cont).find('table thead tr th[data-column-index='+$(this).attr('data-column-index')+']').outerHeight();
          $(cont).find('table thead tr th[data-column-index='+$(this).attr('data-column-index')+']').outerWidth();
          let width = $(cont).find('table thead tr th').eq($(this).attr('data-column-index')).outerWidth();
          console.log(width)
          console.log(height)
          $(this).append($('<div></div>').html(' ').addClass('resizeHandler'));
          $(this).css({
            'width': height+'px',
            'height': width+'px'
          })
        });
Posted
Comments
j snooze 11-Oct-18 17:27pm    
Is there a reason you wouldn't just use a css file instead of trying to do everything through javascript?
Munkhdelger95 11-Oct-18 21:15pm    
plain css would be fine but i don't know how to do it would you show me something on your idea

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900