'Stop running script' message in browser

'Stop running script' message in browser

pradyumnapradyumna Posts: 5Questions: 0Answers: 0
edited June 2009 in General
I am using 1.4.3 version. I am rendering 10000 entries using data-table. The browser ( both Firefox 3.0.10 and IE 7) is generating error message 'stop running script - a script on this page is causing Internet explorer to run slowly. If it continues to run, your computer may become unresponsive'.

I am using these options for the data-table:

$(document).ready(function() {
$('#table').dataTable( {
"bProcessing": true,
"iDisplayLength": 50,
"aaSorting": [[0,'asc']]
//"bSort": false,

});

Can anybody suggest a solution?

Otherwise, I am pretty impressed by the simplicity and number of features available. It is really a marvelous job by Allan!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi pradyumna,

    Thanks for your kind words! The reason for the slow script error is that DataTables needs to do a LOT of processing for 10'000 records. There are a few things you can do to speed things up though:

    - disable sorting column classes with bSortClasses ( http://datatables.net/usage#bSortClasses )
    - disable (or optimise) sorting

    But probably your best bet for this many records would be to use DataTables 1.5's sever-side processing option (assuming that this viable for you). That way all the processing will be done lightning fast on the server-side.

    Hope this helps,
    Allan
  • pradyumnapradyumna Posts: 5Questions: 0Answers: 0
    I will implement your suggestion for speeding up rendering. Also, I have downloaded 1.5 beta version. Let me see, if server-side processing is possible.
    Thanks once again.
  • pradyumnapradyumna Posts: 5Questions: 0Answers: 0
    I am trying server side processing as suggested by you in my application. I don't know much about JQuery and is using Datatables as a blackbox for my page till now.

    For server side processing, I downloaded Datatables 1.5 beta version. I am having some problems. Here is my html:



    {% block title %}{% endblock %}





    $(document).ready(function() {
    $('#table').dataTable( {

    "aoColumns":[{"sTitle":"Engine"},{"sTitle":"Browser"},{"sTitle":"Platform"}],
    "bProcessing": true,
    "bServerSide": true,
    "bAutoWidth": true,
    "bSort":false,
    "sAjaxSource": "/servicemap/ajax_data"
    });
    } );



    {%block content_title%}
    {% endblock %}









    On the server side, I am able to generate JSON string in my Django code:

    {"iTotalRecords": 3, "aaData": [["Trident", "Internet Explorer 4.0", "Win 95+"], ["Trident", "Internet Explorer 5.0", "Win 95+"], ["Trident", "Internet Explorer 5.5", "Win 95+"]], "iTotalDisplayRecords": 3}

    Now, this needs to be linked to a JQuery function. How to do this? It may be simple. But, I am not able to figure it out. I have gone through the example of server side scripting code at http://www.datatables.net/examples/example_ajax_source.html and other examples. You are passing iDisplayStart and iDisplayLength.
    Any help is appreciated.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    If you are using server-side processing, then you are probably best off looking at this example http://datatables.net/1.5-beta/examples/data_sources/server_side.html rather than the sAjaxSource one. I don't see anything wrong with your JSON there, so just needs to be sent as a return to the request for "/servicemap/ajax_data". Is this what you are doing?

    Allan
  • abbottmwabbottmw Posts: 29Questions: 0Answers: 0
    I have run into this Slow error in IE recently and I was looking into the server-side processing. The problem seems to only exist when i apply the sorting. If sorting isnt applied, then everything works fine. What steps, besides server-side, can I do for sorting?

    Thanks,
    Matthew
This discussion has been closed.