Is there a way to retrieve data from server "in chunks"?

Is there a way to retrieve data from server "in chunks"?

markzzzmarkzzz Posts: 37Questions: 8Answers: 1
edited June 11 in General

Hi,

i'm trying to collect lot of data from server (.net).

Get once, display all, no server side processing. It's an old project which it was designed without pagination, so I must keep this :( No time to do such a big refactoring.

The problem is that server side response is limited to maxjsonlength, which I've reached.
So my idea is to load chunks of collection sequentially, than merge and display. Such as "0 to1000 records, than add, 1000 to 2000 records, than add", till the end of results.

What's the best way? Do you have any example?
ajax call (which is how its working now) seems a "single" call for what I see:

    ajax: {
        url: "@(Url.Action("GridLoadData", "Patients"))"
    },

Thanks for any helps.

Replies

  • kthorngrenkthorngren Posts: 14,167Questions: 25Answers: 3,339

    I would look at using jQuery ajax() instead of the ajax option. First start by initializing an empty Datatable. Next, using a loop, fetch the data in chunks using jQuery ajax(). In the success function use rows.add() to add the rows to the Datatable. The mechanism to define the chunks is based on what your server code supports.

    Kevin

Sign In or Register to comment.