Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: JQuery Datatables

comfix free asked 7 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 7 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 7 years ago

Perfekt thank you!

comfix free answered 7 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

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