While in load the width of the table overflows the screen. How to solve this?
While in load the width of the table overflows the screen. How to solve this?
I have a net datatable and when the load is happening the width exceeds the limits and then it's ok, but it wasn't supposed to be like that. If I do another action that needs load, the width goes back to the limit.
How can I resolve this?
I have a $.ajax and it holds the html in a variable.
Then if there is value here I do this:
$('#Table').html(variable);
So then I have:
var oTable = (<any>$('#Table')).DataTable({
"info": true,
"searching": true,
"pagingType": 'full_numbers',
dom: 'lBfrtip',
buttons: [],
destroy: true,
"columns": [],
"columnDefs": [],
"order": [],
"language": { "url": ""
}
, scrollX: true
, fixedColumns: {
left: 2,
right: 1
}});
Thank you
Answers
Looks like you are using a DOM sourced table. The initial load, in this case, is just the HTML table. Once Datatables initializes it will reformat the table to fit within the container. To do this you will need to set
style="width:100%"
on thetable
tag as shown in this example. This setting might help the initial DOM loading to stay within the container. You could hide thetable
ordiv
the table is in and show it once Datatables initializes usinginitComplete
.Kevin