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

[Solved] Rad Grid-Getting Values of All Rows of a column in Array Thru Javascript

1 Answer 243 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jidesh Guptha
Top achievements
Rank 1
Jidesh Guptha asked on 26 Oct 2009, 01:03 PM
Hi,

I have to get all the row values of a column in to a Array through Javascript. Some one pls help me.

Jidesh

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 27 Oct 2009, 08:18 AM
Hi Jidesh,

You can use RadGrid client API to gather values from RadGrid:
http://www.telerik.com/help/aspnet-ajax/grdgettingradgridclientobject.html
http://www.telerik.com/help/aspnet-ajax/grid_gridtableviewclassmembers.html

/for example - collecting all values in 'ID' column/
01.<script type="text/javascript">
02.        function collect()
03.        {
04.            var mtv = $find("grid").get_masterTableView();
05.            var items = mtv.get_dataItems();
06.            var values = [];
07.            for(var i = 0, j = items.length; i < j; i++)
08.            {
09.                Array.add(values, mtv.getCellByColumnUniqueName(items[i], "ID").innerText);
10.            }
11.  
12.            return values; 
13.        }
14.    </script>


Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Jidesh Guptha
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or