Getting JS error for fetching more than 2000+ data

Getting JS error for fetching more than 2000+ data

saurav85msaurav85m Posts: 4Questions: 0Answers: 0
edited January 2014 in Bug reports
Hi all,
I am using DataTables-1.9.4 in web Project (JSP).
During data fetching, if my data count goes to more than 2000+ then this datatable gives a JS error.
To solve the issue I started to use "Server side processing" approach.
In “Server side processing” approach I have found that to populate each page (pagination page) code hit the DB and get the result.
I don’t want to do this approach as because it will increase my DB hit.
Can anyone suggest what the best solution is?

Thanks
Saurav

Replies

  • tangerinetangerine Posts: 3,341Questions: 35Answers: 394
    You will need to provide more information.
    http://www.datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • allanallan Posts: 60,916Questions: 1Answers: 9,929 Site admin
    What is the JS error you get? Also, have you tried Ajax loading with deferred rendering? See the FAQs: http://datatables.net/faqs#speed .

    And yes, in future, please link to a test case.

    Allan
  • saurav85msaurav85m Posts: 4Questions: 0Answers: 0
    Hi allan,
    First of all I am very sorry I can’t give you the test case as because I am using client network and no one can access this network from outside the network.
    And Yes I am using the AJAX to fetch the data.
    My error is:
    “Stop running this script?
    A Script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive.”
    The code is working fine for the less than 1200 to 1500 data but if the data count is more that 2000 then it gives an error.
    Please go through my Coding logic.

    I have two jsp (Home.jsp and handler.jsp) and one JS (common.js)
    In the Home.js I have two div (div1, activeSection)
    In the div1, I write

    When user click on the image it goes to the activeLoadQuickSearch() JS function.
    This function is in “common.JS” file.
    In this JS function, I have used AJAX and I send the data to another JSP file using (xmlhttp.open("POST", url, true);).
    The in the handler.jsp , my code is-
    1. DB connection
    2. Table creation
    3. Fetching the data
    4. Putting the data in the table
    Then, I get this handler.jsp in the AJAX function using
    document.getElementById(‘activeSection’).innerHTML=xmlhttp.responseText;
    and I customized the datatable using
    $('#QuickSearchResultTable').dataTable( {
    "sPaginationType": "full_numbers"
    } );

    please provide me the solution.
  • allanallan Posts: 60,916Questions: 1Answers: 9,929 Site admin
    The solution is to use ajax loaded data with deferred rendering enabled. See sAjaxSource .

    Allan
  • saurav85msaurav85m Posts: 4Questions: 0Answers: 0
    yes, I agree with you.. to avoid this issue I have already (which I already mentioned in my first post) use sAjaxSource (Server side processing).
    In “Server side processing” approach I have found that to populate each page (pagination page) code hit the DB and get the result.
    I don’t want to do this approach as because it will increase my DB hit.

    Now datatable cannot handle more than 2000+ data in the client side and if I go to the server side approach then I have to increases DB hit which is not a good approach.

    Now what should I do?
  • ashiersashiers Posts: 101Questions: 8Answers: 7
    As an aside I see you're on the Java platform. You might want to consider taking a look at the JED library of classes to include as part of your setup. http://jed-datatables.ca/jed/
  • saurav85msaurav85m Posts: 4Questions: 0Answers: 0
    I saw those things.
    I already spend my 1 week to understand this Datatable and then I started to develop the code. I have to deliver the code at end of this week. Its impossible to incorporate another datatable in my code.
    Is there any other way, that I can solved this problem.

    anything on my coding level change or concept wise change.
  • allanallan Posts: 60,916Questions: 1Answers: 9,929 Site admin
    No - you can use sAjaxSource without using server-side processing. See http://datatables.net/release-datatables/examples/ajax/ajax.html . There are several other Ajax with client-side processing examples as well.

    Allan
  • ashiersashiers Posts: 101Questions: 8Answers: 7
    Just to clarify, Allan is correct in terms of your only recourse for a solution. In addition JED is not another datatable. It was designed to aid the DataTable on this site but on the Java platform. If you're working on the Java platform, which you are, and you want CRUD (Create,Read,Update,Delete) capabilities, JED is the way to go.
  • Trebor006Trebor006 Posts: 1Questions: 0Answers: 0
    I don`t know why but load only the first 20 data...
    I need help.. please
  • allanallan Posts: 60,916Questions: 1Answers: 9,929 Site admin
    Then please follow the forum rules and link to a test case showing the problem. Otherwise we can't offer any help.

    Allan
This discussion has been closed.