This is a migrated thread and some comments may be shown as answers.
Client-side access to data
4 Answers 88 Views
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 13 Nov 2012, 03:05 PM
From the client-side (JavaScript land) can I get access to the data displayed in the grid? Without having to dissect the grid's HTML.

For example:
If a dataset (JSON, ViewModel, ViewBag or etc) is bound to the grid. After grid events (sorting, grouping, filtering) can I get access the the refined data?

All our data is returned from LINQ queries and bound to the grid. With our current provider. Whenever a user modifies the displayed data (sorting, grouping, filtering) we have to interpret those actions and build SQL to reflect all the changes done to the data. :( A messy and potentially weak point in our system I'd very much like to get rid of.

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Nov 2012, 09:01 AM
Hello Greg

If you are using Ajax binding, the currently displayed data can be found on the client by using the Grid dataSource.view method. If Ajax binding is used and you need to get the data on the server, you can find it from the DataSourceResult Data property.
In server binding the data is not available on the client because the table is rendered on the server and if needed the values should be found from the HTML.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Greg
Top achievements
Rank 1
answered on 16 Nov 2012, 01:54 PM
Thanks for the answer. I've got a couple of follow up questions if you don't mind.

In my test project I am using the AJAX method to populate the grid. Do client-side grid events (row selection, sorting, grouping and etc.) have access to the data? Is the "dataSource.view" method of the grid always available to the client-side script? From the link you provided it appears that way, I just want to be certain.
0
Atanu
Top achievements
Rank 1
answered on 19 Nov 2012, 10:16 AM
Yes, that's available every-time in your javascript.
0
Daniel
Telerik team
answered on 21 Nov 2012, 11:50 AM
Hi,

That is correct. In Ajax binding you always have access to the data.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Greg
Top achievements
Rank 1
Atanu
Top achievements
Rank 1
Share this question
or