I'm facing issue while rendering data from server side using Ajax post request

I'm facing issue while rendering data from server side using Ajax post request

BinduBBinduB Posts: 7Questions: 1Answers: 0
edited March 2021 in Free community support

Response from the Server is correct, but the totalRecords and the records in the datatable is not matching.

Observed few things:
1. if the length is given as 10 then draw is not working properly
2. if the length is 50 then draw is working but missing few records at the end.
3. if the length is 100 gets full records but sometimes based on the scrollY value misses few records.

getting confused with scrollY height and length ... if i change these values missing few records in the datatable.

Please help me with this.

This question has an accepted answers - jump to answer

Answers

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    Data should be shown from 991-999 but last draw is making call with below parameters

    Length : 30
    start:910

    Im not able to scroll further as this is end.

    Thanks

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    Hi Colin,

    I have standalone spring application with built-in tomcat. How do i share that here?

    Thanks,
    Bindu

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    If you can share it externally, linking to the page would be easiest. This kind of issue is going to be dependent on your implementation, so we need to see it to progress it.

    Colin

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    Hi Colin,

    I have replicated the issue in the below URL, please take a look.

    Url : https://jsfiddle.net/8hnrz9Lv/3/

    Observations:

    1. If Length = 10 then draw is not working as expected(getting blank screen during initial draw) and at the end less number of records are showing up in the datatables.
    2. If Length = 100 or default length then draw and number of records working perfectly.

    Thank you.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Thanks for that test case, that helps understand what's happening.

    The problem is that when you use Scroller, there's a number of records that Scroller buffers - see scroller.displayBuffer. If you fiddle with the number of records requested, that's going to mess up Scroller in unexpected ways, as you're seeing.

    If you want to return less data from the server, just adjust scroller.displayBuffer,

    Colin

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    Worked !!!

    Thank you Colin :smile:

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    This will help us to update displayBuffer, but how to reduce number of records fetching from the server?(this is why i was updating data.length:10)

    Here by default based on scrollY it fetches 90-100 records from the server, how can i reduce that to 20-30 records?

    Thank you.

  • BinduBBinduB Posts: 7Questions: 1Answers: 0

    worked !!!

    Please ignore the previous comment.

    Thanks for the support.

This discussion has been closed.