I have a remote data service that is set at the server side to pagesize 100.
I need to get 10000+ records back using a single query.
How do I do that?
I have tried using the add and splice methods on an observableArray object but nothing has worked. I have looked all over the place for an example or something close and have not seen anything.
example attempt from inside DataSource Object:
schema: {
data: function (response) {
//apply response to field that was in activeQuery
totalCount = response.totalCount;
// .set overwrites the returned set every time with the next page of data
assetViewModel.set("assets", response.assets);
// length is forever 0 with this
assetViewModel.assets_ds = response.assets.splice(assetViewModel.assets_ds.length,0,response.assets);
// tried using .add but this only works iterating through each of the 100 returned items in a loop - not performant
// we only have the first page of results from assetDataSource at this point
// we can process what we have so far and come back for next page
locationsDataSource.read();
return response;
},
if you need to see more we have to share files off forum thank you!
<update>
found allAssets = allAssets.concat(assetViewModel.assets.slice(0)); is slightly faster than a for loop through response to add items to allAssets
<update #2>
if you have a server that pages out data in small chunks the service calls will be the main slowdown - set expecations appropriately : )
I need to get 10000+ records back using a single query.
How do I do that?
I have tried using the add and splice methods on an observableArray object but nothing has worked. I have looked all over the place for an example or something close and have not seen anything.
example attempt from inside DataSource Object:
schema: {
data: function (response) {
//apply response to field that was in activeQuery
totalCount = response.totalCount;
// .set overwrites the returned set every time with the next page of data
assetViewModel.set("assets", response.assets);
// length is forever 0 with this
assetViewModel.assets_ds = response.assets.splice(assetViewModel.assets_ds.length,0,response.assets);
// tried using .add but this only works iterating through each of the 100 returned items in a loop - not performant
// we only have the first page of results from assetDataSource at this point
// we can process what we have so far and come back for next page
locationsDataSource.read();
return response;
},
if you need to see more we have to share files off forum thank you!
<update>
found allAssets = allAssets.concat(assetViewModel.assets.slice(0)); is slightly faster than a for loop through response to add items to allAssets
<update #2>
if you have a server that pages out data in small chunks the service calls will be the main slowdown - set expecations appropriately : )