Datatables, minimum cols width and minimum width to appear scroll X

Datatables, minimum cols width and minimum width to appear scroll X

itajackassitajackass Posts: 165Questions: 49Answers: 3

I don't know how to solve this.
I've a table with scrollX enabled. If the screen size is bigger than 768px the layout is good and human readable.
If i resize for example from 768px to 556px, columns with input fields are too small in width and scrollX still not appear!
ScrollX finally enable at 556px or less but column with input fields are still too small.
See my pic.
Is there a way to set a minimum width to scrollX to appear and then set a 'minimum' width for some columns?

My table:
table class="display table table-bordered table-striped nowrap" id="table1" style="width:100%">

and my init script:

var table1= $('#table1').DataTable( {
    "aaSorting": [[ 0, "asc" ]],
    bFilter: false,
    responsive: false,
    paging: false,
    "pageLength": -1,
    "info": false,
    scrollCollapse: false,
    scrollY: false,
    scrollX: true,
    "columnDefs": [
        { "orderable": false, "targets": -1 }
    ] 
});

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Try adding table textarea { min-width: 150px; } to your CSS.

    Allan

This discussion has been closed.