Perspective MenuTree Additional props in Items

I’m driving the items prop on a perspective menuTree via database table. I’d like to store the item’s ID along with it’s other properties. I’m able to do it and the tree behaves appropriately, however a little red error icon appears in the designer telling me not to do it (i.e. ‘additional properties are not allowed’). Should I approach this a different way?

Hi @WildeKurt,

While the error appears, nothing prevents additional properties from being used within Perspective. The danger in adding properties like this is one of the following things could occur:

  1. The property you add could be an actual property that is hidden by default for the component. This could lead to unintended consequences when using component.
  2. In the future, we could add that property causing similar unintended consequences that may impact your users when you least expect it.

What we would recommend doing is bind the SQL Query with the additional content to a custom property. Then bind items to the custom property you created using a transform to only return the specific properties our schema has defined. You would then use scripting within components to match up the current menu tree with the values your project needs.

Garth

Thanks, that seems like a reasonable solution.

I think the ability to add custom properties (nearly) anywhere is valuable and helps keep code simple. I’d like to see the property name ‘custom’ be reserved for such use everywhere, similar to the way it works for session and view.