How to use JSON Markup to add dynamic sub elements to the shape? #2769
-
IntroductionI have a requirement similar to the example shown in this QAD Application demo. In that example, the However, I couldn't find any examples using JSON markup to achieve something similar. How can this be done? Please note that all the options will share some common presentation attributes, which I would like to specify in the cell JointJs Version: 4.0.4 Steps to reproduceNo response Restrictions & ConstraintsNo response Does your question relate to JointJS or JointJS+. Select both if applicable.JointJS |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Found a private method that does this -
|
Beta Was this translation helpful? Give feedback.
-
I recommend you to use one of these 2 approaches:
If for some reason you want to dynamically create markup inside element views, don't use JSON markup. Just create a DOM element using the native API (or Vectorizer). The |
Beta Was this translation helpful? Give feedback.
I recommend you to use one of these 2 approaches:
Here's an example how to build the element's markup dynamically: https://jsfiddle.net/kumilingus/z6scbp4r/ (without a need for a custom view). Simple
Here's an example of an element view that implements custom rendering: https://jsfiddle.net/kumilingus/gdks4tc9/6/ (does not use the default JointJS
attrs
mechanism). FlexibleIf for some reason you want to dynamically create markup inside element views, don't use JSON markup. Just create a DOM element using the native API (or Vectorizer). The
attrs
with class names as selectors will still work.