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

[Solved] get_nestedViews results in error - Object doesn't support this property or method

1 Answer 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Debbie
Top achievements
Rank 1
Debbie asked on 13 Aug 2009, 02:21 PM
I have a rad grid with a master (parent) and detailtable (child).

And I tried an example that was posted on another thread, but no matter what I try, I can't get get_nestedViews to work. It always returns error "Object doesn't support this property or method"

Here's the sample I tried....

the aspx..
<script type="text/javascript" language="javascript">  
            function getNestedViewsForFirstMasterItem() {  
                debugger;  
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();  
                alert(masterTable.get_dataItems()[0].get_nestedViews().length);  
            }   
        </script> 
 
        <asp:Button ID="Button1" runat="server" Text="GetNested" OnClientClick="getNestedViewsForFirstMasterItem();return false;" /> 
        <telerik:RadGrid ID="RadGrid1"  GridLines="None" runat="server" OnNeedDataSource="radgrid1_NeedDataSource">  
            <MasterTableView DataKeyNames="ID" Width="100%">  
                <DetailTables> 
                    <telerik:GridTableView DataKeyNames="ID" /> 
                </DetailTables> 
            </MasterTableView> 
        </telerik:RadGrid> 

C#
protected void radgrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)  
        {  
            var dt = new DataTable();  
            dt.Columns.Add("ID"typeof(Int32));  
            dt.Columns.Add("Name"typeof(String));  
            dt.Rows.Add(1, "test");  
            dt.Rows.Add(2, "Another test");  
            RadGrid1.DataSource = dt;  
 
        } 

This seemed so simple, but I can't get it to work.

Please help as I'm trying to access the nested/child tables via JavaScript in order to select the child rows when the parent row is selected. I have everything else working -- I have the selection/deselection of the parent row wired to a javascript function, I force teh parent row to be expanded if it isn't already -- I just can't seem to access the child/nested table to select all of its rows.

Thanks!

- Debbie

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 14 Aug 2009, 07:58 AM
Hello Debbie,

Which version of grid are you using? The get_nestedViews() property is supported from version Q1 2009  i.e., version 2009.1.311 onwards. So if you are using an older version then may have to upload to the later versions inorder to use this property. You may find the following kb article useful, while uploading:

Thanks
Shinu.
Tags
Grid
Asked by
Debbie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or