Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I use the javascript plugin dataTables.fixedHeader and fill the data with ajax. Now I have the problem, that the width of each data-column is dynamically and the header stays on the same static width.

Different width

Code:

HTML:

<table class="table table-striped table-bordered table-hover" id="custTable">
                    <thead>
                        <tr>
                            <th>
                                ......
                            </th>
                            <th>
                                ......
                            </th>
                            <th>
                                ......
                            </th>
......
                        </tr>
                    </thead>
                    <tbody id="dataList"></tbody>
                </table>

JS:

table = $('#custTable').DataTable({
            "dom": "frtiS",
            "deferRender": true,
        });

Fill it:

$('#custTable').dataTable().fnAddData([
               xyz, xyz, xyz, ...
                        ]);
share|improve this question
    
Can you provide more code – Silence Peace Jul 6 at 13:07

1 Answer 1

up vote 3 down vote accepted
+50

Disable automatic column widths.

JS

table = $('#custTable').DataTable({
            "dom": "frtiS",
            "deferRender": true,
            "autoWidth": false
        });

http://datatables.net/reference/option/autoWidth

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.