React Widgets - How to access properties of a datasource parameter ?

0
Hi,   I have setup this in the widget XML definition: <propertyGroup caption="General"> <property key="entityList" type="datasource" isList="true" required="false"> <caption>Entity List</caption> <description>List of entities to pass to the widget</description> </property> </propertyGroup>   I can retrieve them, but only their ids shows up with this: const [objects, setObjects] = useState<ObjectItem[]>([]); useEffect(() => { if (entityList) { setObjects(entityList.items!); } }, [entityList]);   I've tried several ways to get the datasource items attributes but it doesn't work. I'm searching for a way to get the entities "JSON" value of the datasource, and not only their ids.   I have potentially hundreds of items to work with. I don't want to map the entities into string versions (from Mendix) and then parse the string into the widget, it seems dirty to me. The real goal would be to be able to read all the data I want from the items of a datasource given to the widget.   Anyone has any idea about this? Even a source code example of another react widget using a datasource would be great.   Thank you.
asked
2 answers
1

Hey check this may be useful!

 

https://community.mendix.com/link/space/widgets/questions/107377

answered
0

You can add an attribute that represents each item and then get it like this

 

const attributeValue = this.props.myAttributeOnDatasource.get(this.props.myDataSource.items[0]);

 

answered