column width

column width

c14ivanc14ivan Posts: 1Questions: 0Answers: 0

hi everybody,

i have a problem :(
i'm using DataTables 1.10.2 and i have a table width so many columns, im using the scrollX option, I have an option to hide some type of columns based on a class, that's working good but i haven the next problem:
i couldn't define the column width for my table, even when i´m using column defs it's seems to do another thing.

var columndefs = [{targets: 0,searchable: false,width: "26px","cellType": "th"},
            {targets: [1,2],searchable: true,width: "170px","visible": true},
            {targets: [3,4,5,6,7,8,9,10],searchable: false,'orderable': false,width: "60px","type": "html","visible": true}];
    var datatable = $('#gradestable').DataTable( {
        scrollX: true,
        paging: false,
        iDisplayLength: 50,
        columnDefs: columndefs,
        bAutoWidth:false,
        autoWidth: false,
        oLanguage: {
            "sProcessing": "{{ lang('table_processing') }}",
            "sLengthMenu": "{{ lang('table_recordsperpage') }}",
            "sZeroRecords": "{{ lang('table_noregisters') }}",
            "sEmptyTable": "{{ lang('table_empty') }}",
            "sInfo": "{{ lang('table_pager') }}",
            "sInfoEmpty": "{{ lang('table_pagerempty') }}",
            "sInfoFiltered": "{{ lang('table_filtered') }}",
            "sSearch": "{{ lang('table_search') }}",
            "sLoadingRecords": "{{ lang('table_loading') }}",
            "oAria": {
                "sSortAscending": "{{ lang('table_sortAsc') }}",
                "sSortDescending": "{{ lang('table_sortDesc') }}",
            },
            "oPaginate": {
                "sFirst": "{{ lang('table_first') }}",
                "sLast": "{{ lang('table_last') }}",
                "sNext": "{{ lang('table_next') }}",
                "sPrevious": "{{ lang('table_previous') }}",
            },
        }
    } );
    new $.fn.dataTable.FixedColumns( datatable, {leftColumns:3,heightMatch: "auto"});

when the table is loaded the column widths doesn't works and when i hide some columns this thing recalculate the widths (i supposed its try to mantain the scrollX and do that for ensure this) and thats awful!! becouse i want to get my widths quiet, i don't want that it change that!

anyone knows what should i do?

in that code i have a number of columns defined but that code is generated dinamycally according to the server side, it can grows a lot, I want to get my first 3 columns always equal, not recalculated or modified or nothing

thanks for the help

This discussion has been closed.