Datatables elements not follow table size

Datatables elements not follow table size

SasaZSasaZ Posts: 2Questions: 1Answers: 0

I recently started playing with bootstrap and datatables. I have a table created with bootstrap which is 50rem wide but datatables elements (search, filter, pagination) stays 100% wide. How can I adjust that so datatable elements follow table width.

I use this <table id=datatable1 class='table' style='width: 50rem';> followed by standard table elements.

Thanks

Answers

  • SasaZSasaZ Posts: 2Questions: 1Answers: 0

    I figured it out... I added div and specified the same width as for a table.

  • vinodvramanvinodvraman Posts: 2Questions: 0Answers: 0

    <

    table> should be in a

    <

    div id='container'>
    set table width 100%;

    and in

    window resize()
    {
    container.find(".dataTables_scrollBody").css('height', container.height() - 80);
    }

    adjust the scrollbody height

  • jgethersjgethers Posts: 3Questions: 1Answers: 0

    This does not work for me.

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    @jgethers We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.