how do I control datatables columns width in all browsers?

how do I control datatables columns width in all browsers?

gzohargzohar Posts: 2Questions: 1Answers: 0

i tried:
"aoColumnDefs" : [
{ "sWidth": "50%", "aTargets": [ 0 ] }

"aoColumnDefs" : [
{ "sWidth": "50%", "aTargets": [ 0 ] }

"aoColumnDefs" : [
{ "width": "20%", "targets": 0 }

I also tried assigning classes to the header columns and then set the min-width in css:

      .col_name  {min-width:60%;}
      .col_eb    {width:10%;} 
      .col_pos   {width:10%;} 
      .col_ag    {width:10%;} 
      .col_qual  {width:10%; } 

                     <tr>
                         <th class="col_name">Name</th>
                         <th class="col_eb">End Bill $</th>
                         <th class="col_pos">Position / Rank</th>
                         <th class="col_ag">Average Growth<br /><span style="color:#1dec02;">$/Person</span> or <span style="color:red">Actual %</span></th>
                         <th class="col_qual">Qualified</th>
                         <th>Meta</th>
                     </tr>

this worked only in Firefox but not in Chrome or IE

I am using Version: 1.9.1

can anybody help?

thanks in advance.

Replies

  • kthorngrenkthorngren Posts: 21,337Questions: 26Answers: 4,954

    Do you have no-wrap configured on your table? If so try removing it to see if the result is what you want.

    The data within the cells have an affect on the column width calculations. Maybe you can put together a [test case]https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case() with an example of your data and table config. This will help with troubleshooting.

    Kevin

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    I am using Version: 1.9.1

    Wow - that's 3 or 4 years old! Try the latest release (1.10.15) as the first thing.

    Allan

This discussion has been closed.