Question: Load datatabe from html-dom and on action make server-side ajax request

Question

Load datatabe from html-dom and on action make server-side ajax request

Answers 1
Added at 2017-01-05 08:01
Tags
Question

Basically I have a page that just have a server-side ajax based datatable. The ajax takes few seconds to load the data and the page is useless until then.

I think this takes 2 round http trips, one for page call and one for ajax. If I load the datatable from dom for initial request then how can I make it to user server-side ajax on interaction (next, search, sort etc.)

I assume this approach is better and fast in my opinion but I don't know how to achieve this, if I should.

Answers to

Load datatabe from html-dom and on action make server-side ajax request

nr: #1 dodano: 2017-01-06 03:01

You can just add

deferRender: true

to your DataTable options. This way, DataTable will create the table the moment it has the number of your displayLength and not wait for all your data to be retrieved.

See Reference: https://datatables.net/reference/option/deferRender

Source Show
◀ Wstecz