I'm populated the grid with a long running process.
I have this loop, it takes about 10 seconds to get 5 results, but let's say there are 20 results.
How do I add the 5 results to the grid and keep appending to it as the results come in?
I'm using asp.net mvc to get the data.
I saw someone ask this a while back, but was just wondering if this feature has been added or anything.
Thanks!
6 Answers, 1 is accepted
This is not a question about paging - assume my paging limit is set to 100.
Say you are doing something custom on the backend (like querying multiple tables) where you only getting 5 results every 10 seconds.
How do you append to the grid as you get the results? (as opposed to having the user wait for all the results to come in at once)
If I understand correctly, if there are 5 results on the page and after 5 seconds new 5 come, the Grid has to show all 10 items?
If this is correct, it can be achieved using the add method of the Kendo UI DataSource. Once the new data is available, use the add method to append the new items in the DataSource:
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-add
Also, if the Grid is not re-rendered with the new data, use the refresh method to re-render the Grid:
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-refresh
I hope this will help to achieve the desired result.
Regards,
Stefan
Telerik by Progress
Thanks Stefan,
Correct, this is the scenario.
Your answer helps me with the client side.
But on the server side, are there any tricks I can use to 'stream' the data back (I'm using ASP MVC)? i.e. after each iteration of a loop, can I "return" the results to the UI? I don't think I can, but just thought I'd ask.
I guess I can rewrite my Controller method a bit to just do one iteration of the loop and have the javascript make the web request to the controller method
Unfortunately, we do not have specific tips for implementing data streaming as the Kendo UI is responsible for the client-side result and the server-side implementation is based on the developers' preference.
In this scenario I can recommend our Progress Professional Services team which will be happy to assist you and provide a solution best suited for your scenario:
https://www.progress.com/services/outsourcing/feature-customization
Let me know if you are interested, and I will arrange for someone from the team to contact you.
Regards,
Stefan
Telerik by Progress
Thanks Stefan,
This was just a 'nice to have' feature for us, but if we change our minds, I'll reach out.
I appreciate you answering my questions!