Access the $item value of a collection from a Javacripts Expression variable

1
0
-1
How can I access the $ item value of a collection from a Javacripts Expression variable?

Thank you so much :)
1 answer

1
0
-1
This one is the BEST answer!

Hello,
Variables are global to the page.
So you need to declare a function with a parameter inside your javacript expression and call this function passing $item as attribute from a widget inside the repeatable container.
For example if your javascript expression variable is named "itemController "and you declare a function "getItemDisplayName(item)" in it, then you can use "itemController.getItemDisplayName($item)" from a widget property inside the repeatable container (just make sure you set the binding type to "expression" for this property (button on the right of the property value).

HTH

Notifications