Issue with template height in vision

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

template open when i click on it:
image

Same thing in a window:
image
result when i click on it:
image

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

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.)

1 Like

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 ?

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…

This is what i was afraid…

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

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

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…

Inside the tree view, no.

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

Hi,

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

screen of the final rendering:

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)

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

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).

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.

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

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:

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.

1 Like