Why does OrgChart parent width control spacing of child items?

1 Answer 42 Views
OrgChart
Martin
Top achievements
Rank 1
Martin asked on 17 Jan 2024, 06:52 PM

Using the Kendo UI Dojo, I have the code seen at the bottom. There are also two screenshots.

If you run this, you will find that the child elements are widely spaced apart even though their own content is small.  If I change the value of item ID 1 to 10 characters, the spacing shrinks to reasonable distances (see screenshots below).  I don't understand why the parent width should affect the child widths.  Is there any way for me to correct this?

Thank you,

Tom Clark

<!DOCTYPE html>

<html>
<head>
    <base href="https://demos.telerik.com/kendo-ui/orgchart/index">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link href="https://kendo.cdn.telerik.com/themes/7.0.2/default/default-main.css" rel="stylesheet" />
    <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>

    <script src="https://kendo.cdn.telerik.com/2023.3.1114/js/kendo.all.min.js"></script>

    <style>
.k-card {
    border: none !important;
    background-color: inherit !important;
}

.k-orgchart-card {
    width: auto !important;
}

.k-orgchart-node-group-container {
    padding: 0 !important;
}

.k-button {
    cursor: default !important;
    outline: none !important;
}

.k-orgchart-line-v, .k-orgchart-line-h {
    color: #000000 !important;
}

.org-chart-item {
    padding: 10px 15px 10px 15px !important;
    white-space: nowrap !important;
    font-size: 12px !important;
}

  </style>
</head>
<body>
    <div id="example">    
    <div id="orgchart"></div>

    <script>
        var data = [
            { id: 1, name: "123456789012345678901234567890", expanded: true },
            { id: 2, name: "Clevey Thrustfield", parentId: 1 },
            { id: 3, name: "Carol Baker", parentId: 1 },
            { id: 4, name: "Kendra Howell",parentId: 1 },
            { id: 5, name: "Sean Rusell",parentId: 1 },
            { id: 6, name: "Steven North", parentId: 1 },
          { id: 7, name: "Frank Furter", parentId: 1 }
        ];

        $("#orgchart").kendoOrgChart({
            dataSource: data,
          collapse: function (e) { e.preventDefault(); },
          editable: false,
          groupField: "name",
          groupHeaderTemplate: "",
          template: `<div class="org-chart-item">#: name #</div>`
        });
    </script>    
</div>
</body>
</html>

DISPLAY WHEN PARENT WIDTH IS LARGE:

DISPLAY WHEN PARENT WIDTH IS SMALL:

               

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 22 Jan 2024, 09:38 AM

Hi Martin,

I would suggest taking a look at the following forum thread where the issue and the observed appearance are explained in more detail:

https://www.telerik.com/forums/how-to-adjust-spacing-or-size-of-orgchart#5519102

In the forum, you will also find a link to a related feature request for improving the ORgChart rendering that I would encourage you to cast a vote for.

Let me know in case you have additional questions on the matter.

Regards,
Neli
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Martin
Top achievements
Rank 1
commented on 23 Jan 2024, 10:59 PM | edited

Yes, I had seen the feature request and just now voted for it.  I'm still exploring what I can and can't do with the orgchart.  This width behavior is odd, so I'm glad others have seen it too.  I realize there is no current resolution or explanation for the behavior I'm seeing though.

I'm using it to display relationships between objects and not as a proper personnel orgchart.  So far it works well for a simple parent/child diagram which is all our application is currently using, but I'm working on an upgrade to be able to visualize different relationships, so I'm likely going to be pushing the boundaries.

Lawrance
Top achievements
Rank 1
commented on 19 Feb 2024, 05:27 PM

@Martin, did you add a feature request?  Looks useful for what I'm doing.
Neli
Telerik team
commented on 22 Feb 2024, 09:40 AM

Hi Lawrance,

Please find below a link to the mentioned Feature request:

- https://feedback.telerik.com/kendo-jquery-ui/1538938-improve-horizontal-spacing-between-orgchart-nodes

Regards,

Neli

Tags
OrgChart
Asked by
Martin
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or