BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi,
I have a grid where i don't want to have paging control, but the server will return me the data in chunks, and each time the user keeps scrolling, it will load more data, I have enabled the enableInfiniteScrolling, but the getData function in the CustomDataAdaptor is only being called once, how can I tell the grid that server still has more data and keep loading
Abdul,
Thanks for contacting Syncfusion support.
Kindly share the below details to proceed further with your query.
Regards,
Rajapandiyan S
Hi,
this is the code of the grid
I'm using my own custom service, I'm running the code inside a platform that provide a JSBridge to retrieve the data, there is no URL to request from or something similar, only JS functions
It's working for loading the data for the first time, but then it does not continue requesting the data
For now, I only want to load data, no other operations needed
Abdul,
Since the CustomDataAdaptor is extended from the UrlAdaptor, it expects a response as a JSON object with properties result and count (result- current page records, count- whole records count).
We suggest you to return the proper result and count values to the option.onSuccess method to achieve your requirement. Please find the below code example and sample for your reference.
adaptor: new ej.data.CustomDataAdaptor({ getData: function (option) { var query = JSON.parse(option.data); var take = query.take; var skip = query.skip; var url = SERVICE_URI + '?$count=true'; if (skip) { url = url + '&$skip=' + skip; } if (take) { url = url + '&$top=' + take; } var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if (this.readyState == 4) { request = ej.base.extend({}, option, { httpRequest: xhttp }); if ( (xhttp.status >= 200 && xhttp.status <= 299) || xhttp.status === 304 ) { datatemp = JSON.parse(xhttp.responseText); var gridData = { result: datatemp.value, // contains current page records count: datatemp['@odata.count'], // contains whole records count }; console.log(gridData); option.onSuccess(gridData, request); } else { option.onFailure(request); } } }; xhttp.open('GET', url, true); xhttp.send(); }, }), });
|
Sample: https://stackblitz.com/edit/as4fom-juprio?file=index.js
Regards,
Rajapandiyan S
Hi,
Thanks, i though the count will be the current request result count, and not the total count, now it's keep requesting data as needed
Abdul,
We are happy to hear that you have achieved your requirement with the solution provided.
Please get back to us if you need further assistance.
Regards,
Rajapandiyan S