Even using responsive option in jquery datatables it happens that in lower resolutions the calculated width of table is more than the parent div, so this is happening:
The table is defined like this:
<table id="datatableGroupsList" class="table table-striped table-bordered responsive no-wrap table-hover partialViewPanel" cellspacing="0" width="100%">
And the datatables script called like this:
/* Datatables responsive */
var dataTableGroupList = function () {
var table = $('#datatableGroupsList').DataTable({
responsive: true,
"columns": [null, null, null, { "orderable": false } //Desabilitar ordenação na coluna das acções
],
language: {
url: window.location.origin + '/Home/GetLocalizationForDataTable'
},
paging: true
}).on("init", function () {
var tt = new $.fn.dataTable.TableTools(table,
{
"aButtons": [
{
"sExtends": "copy",
"sButtonText": "@Resources.ResourcesGeneral.Copy",
"mColumns": [0, 1, 2]
},
{
"sExtends": "xls",
"mColumns": [0, 1, 2]
},
{
"sExtends": "pdf",
"mColumns": [0, 1, 2]
},
{
"sExtends": "print",
"sButtonText": "@Resources.ResourcesGeneral.Print",
"mColumns": [0, 1, 2]
}
]
}
);
$(tt.fnContainer()).insertBefore('#datatableGroupsList_wrapper div.dataTables_filter');
$('.DTTT_container').addClass('btn-group');
$('.DTTT_container a').addClass('btn btn-default btn-md');
$('.dataTables_filter input').attr("placeholder", "@(Resources.ResourcesGeneral.Search)...");
})
;
}
$(document).ready(function () {
dataTableGroupList();
});
Btw, this question is about the same i'm asking: jQuery DataTables: control table width Also i'm using version 1.10.2 of datatable.js
Does anyone had this problem and/or knows the solution? Thanks.