Giter VIP home page Giter VIP logo

Comments (9)

 avatar commented on July 17, 2024

Can you link to a test case showing the issue please. Scroller should adjust the number of rows required before the first draw.

from scroller.

amanique avatar amanique commented on July 17, 2024

This is my table configuration:

datatable = $table.DataTable(
{
"dom": 'lCfrtiS',
"ajax": ajax,
"columns": columns,
"deferRender": true,
"lengthMenu": [10, 25, 50],
"processing": true,
"serverSide": true,
"scrollX": true,
"scrollY": "400px",
"scrollCollapse": true,
"scroller": {
"displayBuffer": 2
},
"columnDefs": [{
"searchable": false,
"orderable": true,
"targets": 0
}],
"order": [[ 0, 'desc' ]]
}
);

In the attached image you can see that until it reaches the full 26 rows requested, 10 ajax requests are made to my server requesting always some overlapped rows.

print01

from scroller.

amanique avatar amanique commented on July 17, 2024

Sorry i close this issue by mistake

from scroller.

 avatar commented on July 17, 2024

Can you link to a test page showing the issue please? I don't know from the above code why multiple requests would be made.

from scroller.

amanique avatar amanique commented on July 17, 2024

Hi, thanks for the reply. I think i can reproduce the error in this fiddle:
https://jsfiddle.net/amanique/28cv7e4d/4/

If you watch the console log, you can see it makes several ajax calls starting at a row it already requested previously. It is almost getting two lines at the time.

Thanks for the help

from scroller.

 avatar commented on July 17, 2024

I don't understand this loop: for (var j = 0; j < displayBuffer; j++) {, but other than that it appears to work as expected for me. You've got a really short display buffer which I wouldn't recommend, but that is up to you!

I would also suggest removing the page length control option since Scroller controls the page length.

The one thing that is a bit ugly in terms of multiple requests is that when the table is loaded two requests are made. That unfortunately is unavoidable - the first is DataTables default data request and the second is scroller asking for more data. I haven't yet found a good way to address that.

from scroller.

amanique avatar amanique commented on July 17, 2024

Thanks again for your reply. One last try though...

I've updated the fiddle, removing the loop you mencioned, i was just trying to generate enough data for the scroller displaybuffer, cause i didn't realize that scroller already changes the data.start. And i also increased the bufferdisplay to 10. You can test it in the same url i gave you before.

My final doubt is:
Why is scroller requesting rows it already requested before?
The first call requests 120 rows, why aren't these rows somehow cached so we can avoid so many server requests? Can't this cause server overload?
Even if i increase the buffer, the second ajax call requests, now in this updated case, 120 rows starting from the 10th. But i already have the 120 first rows, can't i ask for the next 120? Meaning start at 121 with 120 of length?

Once again thank you for your time.

from scroller.

amanique avatar amanique commented on July 17, 2024

I've found a discussion in the bugs forum that seems to be about the same problem i'm facing, yet an answer is not provided. I don't know if this issue was solved by email between you and this tommck user. But if it was could you share the solution please?

from scroller.

 avatar commented on July 17, 2024

Why is scroller requesting rows it already requested before?

It isn't ideal, but this is just the why it is currently implemented. With server-side processing if you do a draw you need to get all data.

The first call requests 120 rows, why aren't these rows somehow cached so we can avoid so many server requests? Can't this cause server overload?

Unless your web-site is extremely popular or a very low powered server, I would say that is extremely unlikely. As I say, it is not ideal, but it is how it currently works.

There is no row caching in DataTables server-side processing by default. If you want that you would need to implement something like this example: http://datatables.net/examples/server_side/pipeline.html

Going to close this for now as it is behaving as expected, even if not perfect.

from scroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.