OrgChart Javascript errors on load

3 posts, 1 answers
  1. Kyle Smith
    Kyle Smith avatar
    42 posts
    Member since:
    Feb 2012

    Posted 26 Oct 2012 Link to this post

    I have been using a 2012 Q2 release for a good while and have been using the Org Chart. With the Q3 update, I noticed it was now possible to get the node or item ID from client side javascript code (the Edit Employees demo). I've updated my Telerik version to the latest stable Q3 (2012.3.1016) and am getting javascript errors on page load. The error is as follows:

    Uncaught TypeError: Cannot read property 'groupItems' of undefined                      ScriptResource.axd:774

    I have copied the client side code exactly from the demo for showing/hiding the context menu. The following lines fail with an error (most likely due to the initial error):
    var item = org._extractGroupItemFromDomElement(target);
    var node = org._extractNodeFromDomElement(target);

    The error for these two lines is:
    Uncaught TypeError: Cannot read property 'nodes' of undefined                        ScriptResource.axd:788

    Here is my definition of the Org Chart in the ASPX file:
    <telerik:RadOrgChart ID="RadOrgChart1" runat="server" EnableDragAndDrop="True" OnGroupItemDrop="RadOrgChart1OnGroupItemDrop"
        OnNodeDrop="RadOrgChart1OnNodeDrop" DisableDefaultImage="True" GroupColumnCount="2">
        <GroupEnabledBinding>
            <NodeBindingSettings DataFieldID="TeamID" DataFieldParentID="ReportsTo" DataSourceID="TeamDataSource"/>
            <GroupItemBindingSettings DataFieldID="StaffID" DataFieldNodeID="TeamID" DataTextField="Name" DataSourceID="StaffDataSource"/>
        </GroupEnabledBinding>
        <RenderedFields>
            <NodeFields>
                <telerik:OrgChartRenderedField DataField="TeamName"/>
            </NodeFields>
        </RenderedFields>
        <ItemTemplate>
            <span><%#DataBinder.Eval(Container.DataItem, "Name")%></span>
            <br />
            <span><%#DataBinder.Eval(Container.DataItem, "IsSupervisor").ToString() == "True" ? "Supervisor" : ""%></span>
        </ItemTemplate>
    </telerik:RadOrgChart>


    Additionally, I should mention I am using the .NET 3.5 assemblies as this org chart is being hosted on a SharePoint 2010 Application Page. I am also using an AjaxManager to ajaxify the org chart based on various controls on the page. However, the same issue happens without the org chart being ajax enabled.


    ************EDIT: This is easily reproduced by having grouping enabled with two or more groups that do not have a parent set (so two groups that are not linked hierarchically, they are at the same level with no children or parents). Because of the initial error, dragging and dropping is broken and cannot be used to establish a hierarchical definition and thereby fixing the issue.
  2. Answer
    Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 30 Oct 2012 Link to this post

    Hi Clark,

    Keep in mind that RadOrgChart control supports only cases with one root node. The organizational control is designed to visualize strictly hierarchy with one root and no multiparents. For your case please create a root node for the described ones and test it again. In case that you still find some difficulties please setup a runnable sample and send it for a local investigation.

    Regards,
    Peter Filipov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kyle Smith
    Kyle Smith avatar
    42 posts
    Member since:
    Feb 2012

    Posted 30 Oct 2012 Link to this post

    The way I was using the Org Chart in the Q2 release was working, which is why I was confused. HOWEVER, I am sort of glad it stopped working because the way I am setting it up now will be much better (and I think will make more sense). I'll be back asking for more help if I find anymore issues.

    Thanks!
Back to Top