# Issue with template height in vision

**URL:** <https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [May 10, 2021, 9:38am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525 "2021-05-10T09:38:58Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 10, 2021, 9:38am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/1 "2021-05-10T09:38:58Z")

</div>

Hi,

I’m currently creating a sort of menu tree with template in vision.  
On my template the height change dynamically when i click on it (depend of several internal properties)  
On my template when i toggle in preview mode, it works.  
When i put it on a view and toggle in preview mode, it doesn’t work and in don’t understand why…  
I’m sure that all script are correctly executed (trace with log).

Some screen to illustrate the issue:  
template master:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e741be77a1b79b769f4df6e8e64ea5b6d5178d26.png)

template open when i click on it:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/4/a4172a904db7cdfaf48deb352398ce6e849d6fb7.png)

Same thing in a window:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/5/45103fbd3a884ce6b61b9d4d62d49978a258c469.png)  
result when i click on it:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/5/05b207cee983a470a153bc1d67264e9b46be6df6.png)

If someone have already encounter this issue, or got an idea to solve this issue, i take it !

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2021, 12:24pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/2 "2021-05-10T12:24:47Z")

</div>

You have to change the height of the template instance, not the template itself. The size of a template when designing is expected to be replaced where it is used.

(Also, in Vision, they are _windows_ and _containers_, not _views_.)

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 10, 2021, 12:42pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/3 "2021-05-10T12:42:16Z")

</div>

Hi,

Thanks for your answer.  
It means that i have to create a template properties (for example “height\_instance”) to bind on the height template ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2021, 12:50pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/4 "2021-05-10T12:50:53Z")

</div>

I’m not so sure how that would help. The issue is that a template cannot change its _runtime_ height. Only the window (or template repeater/canvas) that holds the template can change its height.

You might be using the wrong component for a tree structure…

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 10, 2021, 2:17pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/5 "2021-05-10T14:17:15Z")

</div>

> [@pturmel](#):
>
> IThe issue is that a template cannot change its _runtime_ height.

This is what i was afraid...

> [@pturmel](#):
>
> You might be using the wrong component for a tree structure....

What's the component do you think i had to use to getting a simular rendering ?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2021, 3:59pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/6 "2021-05-10T15:59:01Z")

</div>

I would use the TreeView component with a large Template instance beside it, so that selected rows in the TreeView would drive the binding(s) on the template.

[https://docs.inductiveautomation.com/display/DOC81/Vision+-+Tree+View](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Tree+View)

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 10, 2021, 4:29pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/7 "2021-05-10T16:29:20Z")

</div>

I’ve never use TreeView component, is it possible to use a template into a treeView ?  
I have to respect a graphic chart so i can’t totally modify the rendering of the window…

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 10, 2021, 6:46pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/8 "2021-05-10T18:46:38Z")

</div>

> [@clement.faure](#):
>
> is it possible to use a template into a treeView ?

**Inside** the tree view, no.

> [@clement.faure](#):
>
> so i can’t totally modify the rendering of the window

You may have to share more of your application so we can see how to advise you.

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 11, 2021, 8:32am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/9 "2021-05-11T08:32:18Z")

</div>

Hi,

First, sorry for the bad quality of my English, I'm trying to improve it!

> [@](#):
>
> You may have to share more of your application so we can see how to advise you.

screen of the final rendering:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/043a439408f191c1bdf71be8f101161f45662a18.jpeg)

To explain quickly, i have many building, each of them have a specific number of equipment. For each equipment i have to display their status with different icon (the red bubble show the number of alarm attached to a building or an equipment)  
All these information are stock in a database (sql).  
I've create a template for the building and an other template for the equipment.  
In the building template i have a template repeater of equipment template (the number of equipment is obtained with a SQL query)

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 11, 2021, 9:32am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/10 "2021-05-11T09:32:01Z")

</div>

> [@clement.faure](#):
>
> When i put it on a view and toggle in preview mode, it doesn’t work

When you say it doesnt work, what do you mean? Does it seemingly do nothing, or does it disappear/make the height something unexpected?

How are you changing the height? (wondering if you're using system.gui.transform. If so, try using the designer coord space)

As an aside, this would be so easy to do in Perspective

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 11, 2021, 9:53am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/11 "2021-05-11T09:53:14Z")

</div>

In Vision, I would use the template canvas for your case. I would bring the building and equipment datasets into separate custom properties. I would maintain a separate dataset containing the collapsed/expanded status of the nodes. I would compute the canvas dataset with dynamic placement coordinates (x varying for indentation, y a running total of prior heights) based on which “tree” nodes are expanded. The expandable nodes and the leaf nodes would be **separate** templates with fixed heights. The expandable nodes would call a custom method on the canvas to report changes to their expansion status, causing a regen of the canvas dataset (which would then redraw the canvas).

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 11, 2021, 10:22am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/12 "2021-05-11T10:22:20Z")

</div>

> [@](#):
>
> When you say it doesnt work, what do you mean? Does it seemingly do nothing, or does it disappear/make the height something unexpected?

It do nothing.

I'm changing the height directly in the template master (that's why it's not working). I'm not using system.gui.transform, i've try it just now but it don't change the result.

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 11, 2021, 10:23am UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/13 "2021-05-11T10:23:47Z")

</div>

Ok, thank you for your advice, i will try it.

---

<div class="post-metadata">

**Author:** ![clement.faure](https://avatars.discourse-cdn.com/v4/letter/c/e99b99/32.png) [@clement.faure](https://forum.inductiveautomation.com/u/clement.faure)\
**Post date:** [May 12, 2021, 2:24pm UTC](https://forum.inductiveautomation.com/t/issue-with-template-height-in-vision/46525/14 "2021-05-12T14:24:34Z")

</div>

Finally it works, thanks for help.  
As you advice I use a custom method when i expanded/collapsed the node that update his status in a custom properties dataset  
Then i use propertyChange script to regen the canvas dataset.

Final rendering:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a244b41d465c17da6eb5b5e5049749492c56201e.png)

Because of the fixed expand template height, i have a scroll that appears when the number of equipment is more than 3 which is not a problem.
