How to disable data loading during init dataTable?
How to disable data loading during init dataTable?
nmihey
Posts: 6Questions: 3Answers: 0
How do disable ajax the first time I load a page? The data will be loaded by clicking on the button.
Only serverSide = false
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Instead of using
ajax
in the Datatables init code you can use jQuery's ajax function outside of Datatables along withrows.add()
to add the rows into the table. This example will hopefully get you started:http://live.datatables.net/heweruva/1/edit
Kevin
Thank you.
But, I use preXhr and xhr events. In preXhr event, I use settings.iDraw = 0 to display a message from loadingRecords. In your version it does not work. Is there another option to disable data loading when DataTable is initialized? Is it possible to add it in new versions?
Maybe you can update my example with your code to show s what specifically you are doing. It will be easier to help and answer your questions.
Kevin
I now have:
When I do
displayed "My loading message"
If I use jQuery's ajax this will not work.
Thanks. Now I understand better what you are trying to do. The only way I can think to do this is to use the
ajax
function option. Within the function call determine if this is the initial table load and either return an empty response or the result of the ajax call. Fortunately I had an example that was close which I modified here:http://live.datatables.net/dugacuka/1/edit
Hope this example helps you get started.
Kevin
Thanks