Custom dropdown widget mendix 8

0
Hi, I have an enumeration that is passed from Mendix and want to get those values before passing it to my React component and build my html accordingly. As you can see in this picture the dispayValue and value is always null. the only place i can see the enumeration is in formatter. How do I get the enumeration values? Can you please provide a sample of how to build custom dropdown in React/Mendix8. Thanks
asked
4 answers
1

Hi Samim

We do something similar for Native toggle button

https://github.com/mendix/native-mobile-resources/blob/master/packages/toggle-buttons/src/ToggleButtons.tsx#L22

const selectedIndex = this.universe.indexOf(this.props.enum.value!);
const captions = this.universe.map(name => this.props.enum.formatter.format(name));

 

Cheers, Andries

 

answered
0

Hi Andries,

Thanks that worked.

Is it possible to extend a widget(say dropdown) have all its functionalities but just change the way it is rendered?

For example instead of <select> return a <div> with <ul> but the attributes that is entered in Modeler stays same as default dropdown and functions same...hope it is clear enough.

answered
0

That could work, please give it a try

answered
0

Samin, can you share the result with us? Love to see new stuff popping up with version 8.

answered