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?

toriyamatoriyama Posts: 1Questions: 1Answers: 0
edited June 2022 in Free community support

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

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    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 the table tag as shown in this example. This setting might help the initial DOM loading to stay within the container. You could hide the table or div the table is in and show it once Datatables initializes using initComplete.

    Kevin

Sign In or Register to comment.