Defered Rendering with Local Ajax source

Defered Rendering with Local Ajax source

_jthomas_jthomas Posts: 75Questions: 0Answers: 0
edited June 2011 in DataTables 1.8
Hi Allan,
First and foremost, Just tripped on your datatables last week and was bowled over ever since. Hats off for creating a "magical" (Hope it doesn't upset Apple :-) ) product.



Background:
Using sAjaxSource locally with deferred rendering.The local data file is approximately 11 MB with approximately 21K records. Please advise on the following and thanks very much. Let me know if I am doing something wrong. I am also attaching some relavant piece of code at the end.

IE 7
a) The file gets loaded but IE 7 pops up the dialog box warning of long running script. Is there a way to avoid this warning. IE 7 loads everthing though.
b) Though properties like ""aLengthMenu" is specified, the grid still defaults showing 10 records in single page. The total record count is correct though.

Chrome 11
The page displays "Loading..." and does nothing.

[code]




$(document).ready(function() {
var oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "file:///C:/arrays.txt",
"bDeferRender": true,
"aLengthMenu": [[1000, 2500, 5000, -1], [1000, 2500, 5000, "All"]]
} );
} );






Customer #
Customer Name
Phone Number
Avg Volume($ amount)
GPO Contract Name/#







Customer #
Customer Name
Phone Number
Avg Volume($ amount)
GPO Contract Name/#





[/code]

Regards
Joson

Replies

  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Hi Allan,
    Update - It seems by disabling sorting the IE warning went away. Is there a way to dynamically enable or disable sorting and I presume either way, sorting this huge a record set will anyway cause the warning to pop up in IE? Please advise and thanks very much.

    [code]
    "bAutoWidth": false,
    "aaSorting": [],
    "iDisplayLength": 1000,
    "aLengthMenu": [[250, 500, 1000, -1], [250, 500, 1000, "All"]]
    [/code]
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    a. IE7 warning - your second post is correct I'd say. You are trying to sort a large data set in a browser which is well known to have an extremely slow Javascript engine (and the sorting algorithm is well below par as well). Thus this is going to crunch the CPU of the host machine - resulting in the warning. It might be possible to 'chunk' the sorting into sections, but it would still take a very noticeable amount of time for the end user. Basically I'm not sure what can be done other than upgrading the browser to a current generation one or using server-side processing.

    b. http://datatables.net/usage/options#iDisplayLength is used to set the initial page length

    c. Chrome - is there a Javascript error or anything?

    Allan
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    C. Chrome - no there is no warning and there is no CPU activity. IE7 - it hogs CPU for about 30 seconds and displays the data

    Chrome just displays "Loading..." between table header and table footer and "Processing..." just under table footer.

    Thanks!!!
    Joson
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    But is there a Javascript error shown in the developer tools?
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    My Bad - Allan

    XMLHttpRequest cannot load file:///C:/arrays.txt?_=1307393011034. Origin null is not allowed by Access-Control-Allow-Origin.

    is the error
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Allan,
    I passed the --allow-file-access-from-files to chrome.exe and it is now working and stunning fast too.

    Regards
    Joson
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Also, combined with "fnFilterOnReturn" plug in in Chrome 11, the user experience is incredibly smooth. I am trying to show the processing filter when the search is performed too.

    Regards
    Joson
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    Awesome :-). That's excellent to hear that things are looking good with the new features! Thanks for the feedback.

    Regards,
    Allan
  • _jthomas_jthomas Posts: 75Questions: 0Answers: 0
    Just a correction on the size of the local data file
    The local data file is approximately 16 MB with approximately 250K( not 21K records as reported earlier) records.

    Regards
    Joson
This discussion has been closed.