Hello,
I'm working using HTML in Jointjs elements.
As the regarding tutorial point out, the way to provide the template is by defining:
joint.shapes.html.ElementView = joint.dia.ElementView.extend({
template: [
'<div class="html-element">',
'<button class="delete">x</button>',
'<label></label>',
'<span></span>', '<br/>',
'<select><option>--</option><option>one</option><option>two</option></select>',
'<input type="text" value="I\'m HTML input" />',
'</div>'
].join(''),
I've tried to add my custom template like in a backbone view:
joint.shapes.html.ElementView = joint.dia.ElementView.extend({
template: _.template( $('#nodeTemplate').html()),
<body>
...
...
<script id="nodeTemplate" type="text/template">
<div class="html-element">
<label id="summary_state_label"></label> <br id="summary_br"/>
<label id="minimum_state_label"></label>
<select hidden><option>green</option><option>yellow</option><option>red</option></select>
<div class="img_type_details" id="type_image_div">
<img id="icon_img" src="Images/_<%=icon%>.png" >
<img id="status_img" src="Images/circle_<%=status%>.png" alt="<%=status%>">
<img id="summary_img" src="Images/_<%=detail_action%>_details.png" >
</div>
<input id="menu_button" type="image" src="Images/_square_expand.png" >
</div>
</script>
</body>
, but I get the error "TypeError: text.replace is not a function"
Also, I've tried several ways to load the template in the initialize function, but with the same error in the console.
Is there any way to use a custom template defined as <script id="nodeTemplate" type="text/template"> or placed in another file?
Thank you so much in advance.
Isaac.