How do I access the card colors in an OrgChart template?

1 Answer 21 Views
OrgChart
John
Top achievements
Rank 1
John asked on 16 Jan 2025, 10:34 PM

 

      I am trying to recreate the stock template for the org chart so I can add a tooltip and I have everything, except I can't figure out how to access the cardColors array to set the border color of the card.   I thought something like border-color: #= this.cardColors[item.level]# would work, but item is not defined.  What is the proper template entry to access the proper cardColor for the level of the org chart item?

 

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 21 Jan 2025, 11:44 AM

Hello, John,

You can access the color using the below syntax:

template: "<span style='background:#:color# '>#: name #, #: title #</span>",

Here's a small example to try it out. However, that will affect the span element containing the information. That span is wrapped in a div.k-orgchart-card k-card element, which cannot be accessed through the template. Meaning that setting the border-color style would have no effect. You will need to include custom logic to set the style for the wrapping element.

Let me know if you have any questions.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

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