Mx5 widget list of properties, does not work anymore

0
Try to convert a widget to Mx 5. The widget uses a list of properties (like tree widget) <property key="ignored1" type="object" isList="true" required="true"> <caption>Menu Levels</caption> <category>Menu</category> <description>Levels Of the menu</description> <properties> <property key="menuEntity" type="entity" required="true"> While debugging the javascript I can see that every attribute but the "isList" attributes are ignored ignored1: Array[1] 0: Object menuDisplayFormat: "CategoryName" menuEntity: "Categories.Category" menuReference: "Categories.Category_Category/Categories. What is the new way of in Mendix 5? Thank you
asked
3 answers
5

The big difference between 4 and 5 regarding widget properties of type list is that in Mendix 4 the properties were passed to the widget in the form of semicolon separated strings, where in Mendix 5 an array with objects is passed.

In your example, the property of type list itself (ignored1) was not available in your widget. Instead all properties of the list (menuEntity, menuReference, ...) were passed separately to your widget, which then had to be splitted and stitched together to reconstruct the list property.

As of Mendix 5 the list property is passed to the widget as array of objects, so the extra step of reconstructing the list is not needed anymore. The value is available under the name you have given to it in the xml config (ignored1, which should probably be given a better name now that it actually contains the value).

So instead of all separate list properties:

menuEntity: "Categories.Category;Categories.SubCategory",
menuDisplayFormat: "CategoryName;SubCategoryName"

the list itself is passed to your widget:

ignored1: [
    {
        menuEntity: "Categories.Category",
        menuDisplayFormat: "CategoryName"
    },
    {
        menuEntity: "Categories.SubCategory",
        menuDisplayFormat: "SubCategoryName"
    }
]

This is a breaking change. However, all widgets created by Mendix should have been updated already in the app store. If there is no update available for Mendix 5, please file a ticket.

answered
0

Is a complete document available for moving widgets to version 5? What is really deprecated? What are best practices?

answered
0

Note that MX5 passing the parameters in a different way; the Boolean will become real Booleans in widgets

before Mendix 5

if(this.boolpar = 'true') //do something

in the Mendix 5 widget

if(this.boolpar = true) //do something
answered