This is a migrated thread and some comments may be shown as answers.

dynamically add rows to the grid as data comes in?

6 Answers 668 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ambrose
Top achievements
Rank 1
Ambrose asked on 08 Dec 2016, 06:48 PM

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

Sort by
0
carl
Top achievements
Rank 1
answered on 08 Dec 2016, 09:15 PM
This sound like you have your paging limit send to 5 items, which you can increase. But you also have to have [DataSourceRequest] DataSourceRequest that retrieve the name 5 item on the read method.
0
Ambrose
Top achievements
Rank 1
answered on 09 Dec 2016, 07:48 PM

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)

0
Stefan
Telerik team
answered on 12 Dec 2016, 11:47 AM
Hello Ambrose, Carl,

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
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
0
Ambrose
Top achievements
Rank 1
answered on 12 Dec 2016, 07:16 PM

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

0
Stefan
Telerik team
answered on 14 Dec 2016, 11:32 AM
Hello Ambrose,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Ambrose
Top achievements
Rank 1
answered on 14 Dec 2016, 06:21 PM

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!

Tags
Grid
Asked by
Ambrose
Top achievements
Rank 1
Answers by
carl
Top achievements
Rank 1
Ambrose
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or