How do I get access to oSettings if I want to replace the default callback function in AJAX ?

How do I get access to oSettings if I want to replace the default callback function in AJAX ?

genmoltekgenmoltek Posts: 4Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
I hope someone can point me in the right direction.
I just KNOW the answer is probably built into DataTables 1.9X already ..
but I can't see the Trees for the Forrest. :/

I saw the following post regarding 'Script is running too long' Issue on IE 8 (which I am unfortunately forced to use.)
http://datatables.net/forums/discussion/16655/ie8-a-script-on-this-page-is-causing-your-web-browser-to-run-slowly/p1
The code in that discussion thread appears to be using Interval and breaking the JSON returned from Ajax into more manageable chunks.

My problem is the Script is taking too long when CREATING the Table.
I have under 40k records and the AJAX call returns in under a second.

Question #1) Is that solution in the link above only for Tables that have already been drawn ? The name of that function leads me to think that it is for Updating but not useful for creating/initializing.


If the Answer to #1 is 'Yes', then I assume I have to take bits of the default callback and bits from the link above in order to create/initialize a table with Data that won't trigger the 'Script is Running too long' issue.

"If" that assumption is true, then that leads me to my last and most important Question:

Question #2) If I need access to the 'oSettings' object (which is used in the default callback) then should my own custom function use the 'this' pointer to gain access to the 'fnSettings' function ? Per Discussion Post: http://www.datatables.net/beta/1.8/examples/api/api_in_init.html

Replies

  • genmoltekgenmoltek Posts: 4Questions: 0Answers: 0
    edited March 2014
    http://live.datatables.net/boqifob/6/edit?html,css,js,console,output

    I would like to setup the example with Ajax.
    But I dont know of any Source / URL value that the 'live' site supports.
    Was hoping that maybe one of the Ajax Tutorial/Examples would work but no luck (yet).

    Any suggestions are appreciated.
  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Looking at the thread you linked to, the answer to 1 is "Yes".

    So, regarding question 2 - what you could do, is provide your own fnServerData call. Then make your Ajax request, and in the success function, chunk the data as you need. If the first chunk of the DataTables callback and then add the other chunks using fnAddData .

    However, before you do that - try dropping in DataTables 1.10 and make sure you have bDeferRender enabled . 1.10 has one change that will make a major impact on performance, particularly in old IE, and a lot of other little performance changes.

    Allan
  • genmoltekgenmoltek Posts: 4Questions: 0Answers: 0
    edited March 2014
    Thank you very much for your feedback !
    It's good to know that at least I am on the right track.

    I am restudying JavaScript Closures.. and the old cobwebs are starting to clear out -- a bit.


    Is there a sample Ajax call that works with the live datatables site ?
  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    Yup: http://next.datatables.net/manual/tech-notes/9#Ajax-loaded-data .

    Allan
  • genmoltekgenmoltek Posts: 4Questions: 0Answers: 0
    edited March 2014
    Does the Live Site (prior to 10.x beta) support that Ajax functionality as well ?
    I would love to switch over to the 10.x Beta, but I will not be able to do that just yet.

    I keep getting 403 Forbidden Error even with a simple php reference.
    http://live.datatables.net/boqifob/26/edit?html,css,js,console,output

    This is by NO means to be considered a complaint !

    I just want to make sure I understand what is possible with the current 'Live' site that supports the 9.x version of DataTables...
  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin
    You could use the Ajax data sources from 1.10 in 1.9 no problem. The same is not true of the new server-side processing support, since it isn't "forwards compatible" (it is backwards compatible).

    Interested to hear how you get on with 1.10 if you do take the plunge.

    Allan
This discussion has been closed.