Mendix - Widget React

0
Hey, I'm encountering difficulties in calling an action from a datasource within a widget using a functional component. With a class component, I was successful in executing the action upon clicking an object displayed on the screen. However, I cannot achieve the same result with a functional component. I have tried various methods such as execute, executeAction, events, and getting props from the object list. <property key="objectlist" type="datasource" isList="true" required="false"> <caption>Data source</caption> <description /> </property> <property key="onClick" type="action" required="false" dataSource="objectlist"> <caption>On click action</caption> <description /> </property> useEffect(() => { try { const { objectlist } = props; if (objectlist && objectlist.items) { let list = objectlist.items.map( item => item[Object.getOwnPropertySymbols(item)[0]].jsonData.attributes ); setObjectList(list); } } catch (e) { console.log("error", e); } }, [props.objectlist]); const handleClick = (item) => { if (props.onClick) { props.onClick.execute(item); } }; {ObjectList.map((item, index) => { return ( <a onClick={() => handleClick(item)} /> ) })}  
asked
0 answers