Client Side Loading after HTML table

Client Side Loading after HTML table

iainiowiainiow Posts: 1Questions: 1Answers: 0

I have a Datatable that is on a Razor View Component, it is loaded in to a main razor view. The rows on the table are clickable and reload the page to display details of the row that has been clicked. I am using state save to ensure that the page state is persisted across the page load. All works fine.

What isn't working fine is that the page length seems to take a second or so to apply. So say I have 20 rows with a page length of 10, I will see the full 20 rows briefly and then the page will be cut down to the correct length. Ideally I would either see the right length initially, or a loading spinner until datatables is finished.

The data is a client side with no ajax. Is there anything I can do to improve this situation?

Answers

  • kthorngrenkthorngren Posts: 20,264Questions: 26Answers: 4,764

    You can hide the HTML table or container the table is in until Datatables initializes. Then in initComplete display the hidden element. Or you can display a processing element before initializing Datatables then turn it of in `-option initComplete.

    Kevin

Sign In or Register to comment.