Load Initial Data Without Ajax Call

Load Initial Data Without Ajax Call

cblaze22cblaze22 Posts: 5Questions: 0Answers: 0
edited September 2011 in General
I am loading data on an initial ajax call that also gets the options, but I don't want the second ajax call (or first from the perspective of the datatable) to go out to get the inital data since I brought it back with the options request. How can I do this?

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    You've got two options:

    1. Make the Ajax call yourself and then feed the data to the DataTable using fnAddData ( http://datatables.net/api#fnAddData )

    2. Let DataTables make the call for you, then in fnInitComplete ( http://datatables.net/ref#fnInitComplete ) the second parameter will be the JSON object returned from the server.

    Regards,
    Allan
  • cblaze22cblaze22 Posts: 5Questions: 0Answers: 0
    In number one, if I want to AddData manually, then how can I stop the ajax call from making the intial request, so on say page 2, it would make that ajax request.
  • cblaze22cblaze22 Posts: 5Questions: 0Answers: 0
    not sure why you didnt say iDeferLoading, cause that actually worked.
  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Sorry I misunderstood the question! Are you using server-side processing and you want the Ajax request to work thereafter? In which case yes, iDeferLoading would be ideal. Glad you found it :-)

    Allan
This discussion has been closed.