Hello,
I'm using visualTemplate to see from my model (dataItem) whether entity is of one type or the other to use, among other things, corresponding image for the entity.
I'm also using (Editable) Tools under ShapeDefaults to have some custom tools for the entities in the model.
Now, I would like that depending on the entity type from the model I can choose which custom tool will be shown to the user. How can I do this?
For more clarity, mvc razor part:
.ShapeDefaults(sd => sd
.Visual(
"visualTemplate"
)
.Editable(e => e
.Tools(t =>
{
t.Custom().Name(
"firstTypeCustomButton"
);
t.Custom().Name(
"secondTypeCustomButton"
)
}
...
Javascript template:
function
visualTemplate(options) {
...
if
( options.dataItem.EntityType ==
"myFirstType"
) {
group.append(
new
dataviz.diagram.Image({
source:
"@Url.Content("
~/Images/first-type-image.png
")"
,
...
else
if
( options.dataItem.EntityType ==
"mySecondType"
) {
...