Fixed Width Table and dataTables_wrapper!! Help!

Fixed Width Table and dataTables_wrapper!! Help!

RambleCRambleC Posts: 1Questions: 0Answers: 0
edited November 2010 in General
I really need some help. I managed to get my table itself to be fixed width by using the !Important setting in my CSS, however, how can I control the width of the dataTables_wrapper?? It sets itself to 100% regardless, and I'd really like it to set itself to an appropriate width around the table, given that I have scrolling turned on. Any ideas?

Replies

  • peterkronenbergpeterkronenberg Posts: 112Questions: 0Answers: 0
    Not sure if this will help what you're trying to accomplish, but I wrap my own div (#mainDiv) around the table (#mainTable) and did something like this:

    [code]
    // Compute the desired width. 500 is the minimum. Just in case we have a narrow table, we need room for the controls.
    // The pagination stuff tends to be long, so we want to make sure we have enough room for that
    var paginateWidth = 0;
    $('div#mainTable_paginate').children().each(function() {
    paginateWidth += $(this).width();
    });

    var width = Math.max(500, $('table#mainTable').width(), 2*paginateWidth);

    $('div#mainDiv').width(width);
    [/code]
This discussion has been closed.