[IGN-2412] Menu Tree Items Unexpected behavior

I'm using Ignition 8.1.23 for a project in which I have a menu tree configured with some bindings on items display to permit some users enter especial pages depending on their roles.

So, I'm adding some new pages between the ones I already had (not at the end) with right click on an item like 11 and click on "duplicate" I got a new item inserted between 11 and 12... so, the item 11 is still item 11, but the item 12 became item 13, and the new item duplicated is item 12... I hope I am being clear...

The problem is that the binding didn't follow the old item, the binding just stay on item 12 no matter that this is now a duplicated of item 11, and the item 13 that used to be item 12 just lost bindings...

The binding implementation expects that the definition of the binding does not change unless you yourself edit the binding. Also when you create a binding for an entry within a list, you're specifying the index of the entry the binding belongs to not which object or entry.

Then on the back-end, where we store the binding definition, we define it as something like this (from a different component):

    "propConfig": {
      "props.axes[2].name": {  # note the numeric index within the list/array on this line
        "binding": {
          "type": "expr",
          "config": {
            "expression": "\"Something\""
          }
        }
      }
    }

Note that this binding definition defines the index of the binding, but the property itself has no idea about the binding. So when we copy, duplicate, delete, or insert new props into an array, there's no mechanism in place to examine any existing bindings to see if they need to be adjusted.

Let's say I inserted a new axis at the 1th index in my example component. I would now have an axes list with four internal axis objects, 0, 1, 2, and 3. What was my 2th axis object is now my 3th object, it has no binding, and the binding I defined as belonging to the 2th index is still attached to the 2th index.

With all of this being said, we're aware this might not be everyone's expectation and we're looking into ways to improve the handling of bindings during insertion/deletion of elements in a list.

Thanks for the response @cmallonee. So, this is a known topic to improve in the future?

I mean, it is a little annoying because yesterday I added like 3 new items on the menu tree and then my menu tree star working awkward, because I lost pages that should be displayed, and now the ones that should be occult was visible. I had to configure it again, and then I added another new page and that's when I noticed this behavior.

Also, im not sure if this information is explained on some point in the docs or in IU, because a lot of props on perspective use array list, and this is something to have in mind when adding new elements...

Moving one binding manually it's not a problem, but if a had 10 items on a menu tree, all with bindings on visible or enable, and I want to add a new item to show on the top of all, that will become a mess.

Yes, we're aware, but there's some discussion to be had about which way is correct...

If a user defines a binding on an element of a list, do we assume they're applying the binding to the element/object and that binding should move if other elements are inserted? Should the binding always be on that index of the list, even if other elements are inserted/removed?

Many are quick to respond with "I want the binding on the element", BUT there's every possibility that the list is also mutated/modified through scripting, and there's no way to for us to update the binding in that instance.

1 Like

For dynamic bindings on arrya elements, I usually copy the instances to a custom prop.
And then (a structured expression) binding on the array prop, i do the modifications/fill in the values of the copied array for the correct items.