How can i get all enumeration values in javascript?

0
Hi! Currently, I'm making pluggable widget.  How can i get Enumeration values in javascript? For example, let's assume that there are enum values:[{key:key1,value:value1},{key:key2,value:value2},{key:key3,value:value3}]. By using them, I wans to add a select box. How can i acheive it?  
asked
2 answers
1

You need to provide an attribute of type enumeration in the XML. Then you can access the enumeration values using .universe. Below you can find example how to do that. You can find more information in the docs.

 

return (
    <ul>{
        enumerationColumns?.universe?.map((enumItem) => {
            return (enumerationColumns.formatter.format(enumItem))
        })}
    </ul>
)

 

answered
0

I think this function can help.

image.pngPlease refer to https://apidocs.rnd.mendix.com/10/client/mendix_lib_MxMetaObject.html#getEnumMap

answered