Hi - I can see how to add a TextAnnotation at run time with something such as:
this.selectedItem.diagram.addTextAnnotation(
{
id: node.id + "ta",
text: info.rs_id_array.toString(),
length: annotation_length,
angle: annotation_angle,
}, node)
this.selectedItem.diagram.dataBind();
but how do I update the text or remove the TextAnnotation programatically? This is something very important...I have tried all sorts of things with no luck.
Hi,
To update the text annotation double click and edit the annotation. To remove it,we will validate and update you with more details on December 11, 2023
Regards,
Vivisa
Hi!
Actually I know you can double click to edit but in my application the text is set by the user using a properties panel.
It is extremely important that the annotation can be updated and/or removed through code.
Please help!
Hi Kabe,
We can update the text annotation content dynamically, by using the updateTextAnnotationContent method, we need to pass the parent node and existing text annotation details along with the updated content in method parameters. Please find the sample below for reference.
Sample: Gvrdjb (forked) - StackBlitz
Regards,
Sivaranjith
That's amazing! Great!
So now I just need to know how to remove the TextAnnotation.
K
Hi,
Could you please confirm whether you intend to remove the annotation of the node or the entire text annotation node itself?
Regards,
Vivisa
The entire text annotation itself.
Actually I'm not 100% clear on what the difference of the two options is, but I want to remove the TextAnnotation and connector completely. Hope that makes sense.
Hi,
Currently we don't have support to remove the text annotation node. We will validate and update you with more details on December 14,2023.
Regards,
Vivisa
Hi,
Sorry for the inconvenience
Reported Issue: Removing bpmn text annotation dynamically is not working properly.
We can reproduce the issue and confirmed this as a defect. We have logged a defect report for this issue. We will fix this issue and provide the patch on Jan 2,2024 weekly patch release.
Feedback Link: https://www.syncfusion.com/feedback/49271/removing-bpmn-text-annotation-dynamically-is-not-working-properly
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.
Regards,
Vivisa
ok great - I'm very glad to hear there is a solution coming!
Hi Kabe,
We have fixed the issue and provided custom package below. However, we will include the fix for the issue in our upcoming weekly release which is scheduled to release on January 09th, 2024.
Regards,
Sivaranjith
Hi Kabe,
We have fixed the reported issue and included it in our latest patch release which is rolled out successfully.
Please upgrade to the latest version (v24.1.45) packages of the diagram to resolve this issue.
https://www.npmjs.com/package/@syncfusion/ej2-diagrams
Regards,
Moulidharan