DataTables table header width not aligned with table body width | Laravel DataTables

 

sometimes when we use Datatables, Datatables table header or column does not aligned or matched with the table body width .here are two solutions, check which one work for you-

Solution 1: table width 100%

Give your table a style of width 100% for example width=”100%”

Solution 2: use DataTables fixcolumn cdn /columns.adjust() 

add or use fixColumn CDN( https://cdn.datatables.net/fixedcolumns/ ) CSS and js file in your code for that

and add columns.adjust() 

var table = $('#example').DataTable();
table.columns.adjust().draw();
for example

You can also write this way that part

 

Video Link

 

Share with:


Comments are closed.