500 internal server in console.log

500 internal server in console.log

DavidWanDavidWan Posts: 16Questions: 3Answers: 1

Hello,
i am using data tables for the first time.. i have a problem with populating data in browser i want client side pagination which is functioning really well but suppose i have data over 50,000 when the data is returned as JSON.. data tables are able to populate only 200 rows and if it exceeds this margin of rows data tables throw me 500 internal server Error.

Can anybody help me with this issue as i am stuck...i really want it to work..

Thanks

This question has accepted answers - jump to:

Answers

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    Is my question too dumb to be answered let me summarize it a little bit:
    i think it can not be converted to JSON may be of some special characters coming after 200 rows

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    That sounds a lot like a memory issue on the server-side to me, but you'd need to check the server's error logs to determine what is causing the 500 error. That is a server internal error and debugging the client-side code won't be able to help I'm afraid.

    Allan

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    Allan
    Thanks for your reply.. i am getting all the data in a list then i am converting data to JSON which gets successfully converted but when i am sending data as JSON to the Data tables it shows me error 500.

    David

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    Checked the Logs couldn't find anything yeah i would like to add that if the number of data is less then data table gets populated easily.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Answer ✓

    It sounds like you might need to enable error logging in that case. I still think it sounds like a memory issue, but its impossible for me to debug without access to the server I'm afraid.

    Allan

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    allan

    what is the "maxJsonLength" that data table can Understand(this is going to solve my issue) because i tried something and it is working with an error like (data tables length is unidentified) well if i do simple ajax it works their properly but not in data tables so what is it??

    --david

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    jquery.dataTables.min.js:39 Uncaught TypeError: Cannot read property 'length' of undefined
    at ub (jquery.dataTables.min.js:39)
    at jquery.dataTables.min.js:37
    at i (jquery.dataTables.min.js:35)
    at Object.success (jquery.dataTables.min.js:35)
    at fire (jquery-1.12.4.js:3232)
    at Object.fireWith [as resolveWith] (jquery-1.12.4.js:3362)
    at done (jquery-1.12.4.js:9840)
    at XMLHttpRequest.callback (jquery-1.12.4.js:10311)
    ub @ jquery.dataTables.min.js:39
    (anonymous) @ jquery.dataTables.min.js:37
    i @ jquery.dataTables.min.js:35
    success @ jquery.dataTables.min.js:35
    fire @ jquery-1.12.4.js:3232
    fireWith @ jquery-1.12.4.js:3362
    done @ jquery-1.12.4.js:9840
    callback @ jquery-1.12.4.js:10311

    this is my final error

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1
    edited March 2018 Answer ✓

    thanks Allan i solved this length problem by using "datascr":'', in ajax...

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    @allan i tried this option and it worked but it took a lot of time for data to get populated in the datatables so i decided to go for server side to do the pagination:
    i have 3 requirements........
    1:- i tried server side like this

    public ActionResult DataValidationPost()
    {
    //Server Side Parameter
    int start = Convert.ToInt32(Request["start"]);
    int length = Convert.ToInt32(Request["length"]);
    string searchValue = Request["search[value]"];
    string sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"];

            string sortDirection = Request["order[0][dir]"];
    
            /////////////
            DataManager DM = new DataManager();
            List<GISDataValidationVM> listGis = new List<GISDataValidationVM>();
            listGis = DM.GetAllGISValidationData();
            int totalRows = listGis.Count();
            if (!string.IsNullOrEmpty(searchValue)) // filter
            {
                listGis = listGis.Where(x => x.GUID.ToLower().Contains(searchValue.ToLower())).ToList<GISDataValidationVM>();
    
            }
    
            int totalrowsafterFiltering = listGis.Count;
            //Sorting
            //   listGis = listGis.OrderBy(sortColumnName,sortDirection).ToList<GISDataValidationVM>();
    
           ///Paging
    
           listGis = listGis.Skip(start).Take(length).ToList<GISDataValidationVM>();
    
            return Json(new { data = listGis, draw = Request["draw"], recordsTotal = totalRows, recordsFiltered = totalrowsafterFiltering }, JsonRequestBehavior.AllowGet);
        }
    

    Issue#1:-Length =0 always, which gives me empty table inside the data tables..

    2: now that i am doing server side pagination which means selective export won't be working for page no 2 i mean no track of how many rows were selected at page no 1..

    3:Export all.

    can you please help me

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    1) I don't understand why length would be 0 I'm afraid. Do you mean the length parameter that is submitted, or that zero length data is returned?

    2) That is correct and one of the disadvantages of server-side processing.

    3) See this FAQ.

    Allan

  • DavidWanDavidWan Posts: 16Questions: 3Answers: 1

    '''int start = Convert.ToInt32(Request["start"]);'''
    '''int length = Convert.ToInt32(Request["length"]);'''

    Parameter length But i fixed it ..Thanks.

    What about the other issue i know we can not use selective export in server side but i really want that feature in my tool ?
    --David

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Your only option there is to keep a track of the selected row on the server-side and then when the export button is pressed the server would generate the file.

    It can't be done client-side since in server-side processing mode, the data simply isn't present at the client-side.

    Allan

This discussion has been closed.