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

javascript error in grid

3 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saint
Top achievements
Rank 1
Saint asked on 11 Jun 2008, 06:13 AM
Hi,
I have created a javascript in my aspx. But I always get 'Rows.length' is null or not an object error message. Please help me. Below is my javascript:

<script type="text/javascript" language="javascript">
        var grid;
        var i;
       
        function GridCreated()
        {
            grid = this;
        }
   
        function HierarchyExpanding(sender, args)
        {         
           PerformAction(grid.MasterTableView)
          
           if (i != 1000)
           {
               if(!confirm("Are you sure you want to expand without update?"))
                {
                    args.set_cancel(true);
                }
                else
                {
                    $find("<%= RadGrid1.MasterTableView.ClientID %>").collapseItem(i);
                }
           )
        }

        function PerformAction(tableview)
        {
            i = 1000;
            for (var j=0; j < tableview.Rows.length; j++)
            {
                if ($find("<%= RadGrid1.MasterTableView.ClientID %>").get_dataItems()[j].get_expanded())
                {
                    i=j;
                }
            }
        }

    </script>

And this is my radgrid:

<telerik:RadGrid ID="RadGrid1" Skin="Default" runat="server" ShowStatusBar="true"
            Width="95%" AutoGenerateColumns="False" PageSize="5" AllowSorting="True" AllowMultiRowSelection="True"
            AllowPaging="True" GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True">
        <PagerStyle Mode="NumericPages" />
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
            <ClientEvents OnGridCreated="GridCreated" OnHierarchyExpanding="HierarchyExpanding" />
        </ClientSettings>
        <MasterTableView Width="100%" HierarchyLoadMode="Client" .....

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 11 Jun 2008, 12:44 PM
Hello Saint,

Indeed, as the error states, there is no such property. You can get a reference to the master table view and use its get_dataItems() property as in the next line from your code.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Saint
Top achievements
Rank 1
answered on 16 Jun 2008, 01:59 AM
Hi,

I am not understand what you mean by : 'You can get a reference to the master table view and use its get_dataItems() property as in the next line from your code.' ? Is that got any documentation?

Thanks.
0
Konstantin Petkov
Telerik team
answered on 18 Jun 2008, 10:53 AM
Hi Saint,

Sure, you will find the Grid client-side API explained here. I hope this helps.

Regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Saint
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Saint
Top achievements
Rank 1
Share this question
or