Topic: JQuery Datatables

comfix free asked 4 years ago


Hello is there a way to get the Datatables width = 100% ?Get it only Auto width like in the demo https://mdbootstrap.com/content/tables/#sortingThanks for your help!Pano

Ozcan Arslan pro commented 4 years ago

Datatables uses 100% width as default unless you defined different size. In example you pointed columns have fixed sizes with px units, instead you can use percentage for each column so all columns along table width. Also checkout https://datatables.net/extensions/fixedcolumns/examples/initialisation/size_fluid.html this link for different example of usage.

comfix free commented 4 years ago

Perfekt thank you!

comfix free answered 4 years ago


Ok I could find out that if you set min. 1 <th> to 100% the Table gets filled 100% e.g:
<table class="table table-striped table-bordered table-responsive" id="userManagement">
    <thead>
    <tr>

        <th>User Name</th>
        <th style="width: 20%;">Name</th>
        <th>User Role</th>
        <th style="width: 100%;">User Group</th>
        <th></th>
    </tr>
    </thead>
    <tbody>
...


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: Yes
Tags