how to create datatable dummy before initialization to avoid cumulative layout shift issues

how to create datatable dummy before initialization to avoid cumulative layout shift issues

bejbe01bejbe01 Posts: 10Questions: 4Answers: 0

I use datatables a lot but as I see google is penalizing my pages because when page is being loaded, it loads default html table and after datatable is initialized, content is moved because it adds search input, pagination etc. Is there some standard way how to avoid this? Some table dummy template which will datatable replace when initialized?

Answers

  • kthorngrenkthorngren Posts: 21,125Questions: 26Answers: 4,916

    Sounds like you have an HTML sourced table and there is a delay between loading the HTML table and Datatables initialization that causes format changes. If this is the case then see this thread for a few examples of hiding the HTML table then in initComplete displaying the table. Make sure to use columns.adjust() after displaying the table.

    If this doesn't help then please provide a link to your page or a test case replicating the issue so we can help debug and offer more specific suggestions.

    Kevin

Sign In or Register to comment.