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

Possible to append rows?

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 08 Mar 2011, 01:31 AM
I have been working with the grid control (specifically client side binding) and it is really nice once you get Linq figured out.

However, I am wondering if there is a way to append rows to the grid client side via a web service. I suspect there isn't because you need to set the data source to the result set and then rebind if you need a new page of data. This effectively removes all the rows that had been previously sent to the browser. I have a dataset that is about 1000 rows with 17 columns and needed to bump up the maxJasonLength just to get the data. Then there is the performance hit on rendering on the client. So I am sticking with paging but the client isn't too happy.

Maybe there is a hack that someone has figure out. Possibly storing the original JSON object and appending to that? I'm open to ideas.

If not then this would be a nice feature for just a flat grid.

Just thought I's ask.
Thanks,

Craig

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 11 Mar 2011, 08:32 AM
Hi Craig,

Appending rows in unbound mode is not supported in RadGrid. RadGrid items are generated only in respect to the data source it binds to. You can take an alternative approach for your scenario, though. Refer to the RadGrid Virtual Scrolling/Paging demo and, in particular, to the second RadGrid example - Yahoo-style scrolling. Note how additional records are loaded to the grid when you scroll to the bottom of the master table. This example can be set up to work with client-side databinding.

You get very efficient loading of additional records by increasing the page size every time the user scrolls to the bottom. Becase you are using client-side databinding, no server round-trips are required as in the demo (where AJAX is used). And because you increase the page size by a constant amount every time, RadGrid needs to create only as many new rows as your constant (10 in the example). The previous rows are already created.

Attaching a sample test page to demonstrate this scenario. RadGrid is bound on the client to a page method returning 1000 items eventually.

Veli
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Craig
Top achievements
Rank 1
answered on 11 Mar 2011, 06:46 PM
Hi Veli,

Thanks for the reply. I looked at this method that used Ajax and I abandoned it because it was really just increasing the page size. So, once you got to the bottom of the data set you could potentially have a huge page size. Doing this client side make a little more sense but it looks like the test file is using the same logic. Did I miss something here?

My original thought was if you could append you wouldn't have to increase the page size each time to get all the data. The previous calls to get data would be on the client. Possibly some kind of paging with a vertical slider. That way the user is just really paging up and down but it "feels/looks" like scrolling. My other thought was if I could "store" the JSON object and append that but there is still a penalty with binding on the client with a large data set. I am building for IE8 and it is just slow.

Thanks,
Craig
0
Veli
Telerik team
answered on 14 Mar 2011, 04:39 PM
Hello Craig,

I see your point. Have you considered the Virtual Scrolling With Client-Side DataBinding example? The first RadGrid uses virtual scroll paging where the page size stays constant and new items are loaded as you scroll. This is, effectively, another paging approach. You get only a single page of data available at any single point. It may seem more intuitive for client-side databinding scenarios, though. Appending data items to the end (or beginning) of the current items list is really not supported, unfortunately.

Veli
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Craig
Top achievements
Rank 1
Answers by
Veli
Telerik team
Craig
Top achievements
Rank 1
Share this question
or