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

Change shape and connection text dynamically after added

2 Answers 150 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Jong
Top achievements
Rank 1
Veteran
Jong asked on 21 Jan 2021, 05:04 PM

Hello,

How can I change shapes and connections text after adding them to the diagram?

For example, when a user creates a connection, an add event is called which contain a newly created connection object.

And I assigned text to the newly created connection object like this.

e.connection.options.content.text = "True"

 

 

 

But this text change did not apply.

Is there a way to redraw the options? after changing it? or is there any ways to change text dynamically?

Thank you!

2 Answers, 1 is accepted

Sort by
0
Jong
Top achievements
Rank 1
Veteran
answered on 21 Jan 2021, 08:46 PM

I found a solution.
I used redraw() function to change the styles.

 

connection.redraw({
    content: { text: 'True' }
});

Thank you!

0
Anton Mironov
Telerik team
answered on 25 Jan 2021, 09:26 AM

Hi Jong,

Thank you for the provided solution. You are totally correct, this is the recommended approach to achieve the desired behavior.

I recently added a knowledge base article for this approach:

I am now closing this thread. It could be reopened if needed. 

If further assistance is needed, do not hesitate to contact me and the team.

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Diagram
Asked by
Jong
Top achievements
Rank 1
Veteran
Answers by
Jong
Top achievements
Rank 1
Veteran
Anton Mironov
Telerik team
Share this question
or