I am using rxjs to stream data from my server to the front-end in subsets. For example, I have a data set of 10,000 rows and the server will send them in response to the request in chunks of 500, making a total of 20 responses. I'm having some trouble updating the grid's dataSource's data set with each new response from the server. This is what I have so far:
grid.dataSource.transport.read = function (options) { var dataStream = dataRetriever.stream('handler', params, {}).publish(); var first = true; // each response executes this callback
dataStream.subscribe(rx.Observer.create(function (data) { if (first) { first = false; options.success(data); } else { var dataSource = $scope.kg.dataSource; dataSource.data().push.apply(dataSource.data(), data); } })); dataStream.connect();};I tried to iterate over the response and call dataSource.add for each item but the page performance plummeted and blocked the UI. I can't seem to find any other way to add the new response to the existing dataSource, but I feel as though there must be something else that I can do. I doubt that I'm the first to have this issue yet my searching hes led to few results.