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

[Solved] set_dataSource and json + jayrock

1 Answer 138 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kieran
Top achievements
Rank 1
Kieran asked on 24 Feb 2010, 12:33 AM
Hi

Don't know if I'm missing a trick here.
I am using jayrock to return data that is a list of objects serialized into a JSON string. I am am then attempting to set the datasource of a grid as follows:
<a javascript function>
function SetGrid()
{
var service = new JAYROCKService();
var ds = service.getGridData(); //ds is a valid json string
var grid = getGridTable(); //method to get grid object
var mastertable =  grid.get_masterTableView();
mastertable.set_dataSource(ds);
mastertable.dataBind();


This call and ones like it attached to a number of buttons, and they attempt to bind the grid to a number of different data sets depending on which button is pressed. 

The examples I saw were a lot more complicted than this but were also doing a lot that I didn't need. Is the above possible or am I missing a key idea for this approach?

If this is not possible is it possible to add individual rows to a grid on client  side only?

Regards
Kieran






1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 24 Feb 2010, 07:30 AM
Hello Kieran,

There is nothing else that is required to bind RadGrid on client. The only requirement is to set to its client dataSource valid JSON.
Please ensure that the JSON returned from the service is valid. You can use FireBug for example and see the JSON that is being transferred on the following demos:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/declarativedatabinding/defaultvb.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultvb.aspx

Kind regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Kieran
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or