Native Widget DataSource is reflecting mendix reference id instead of objects

0
Hi eveyone,         when i tried to use “datasource” property in native widget then i am getting the Mendix reference id’s. <property key="data" type="datasource" isList="true" required="true"> <caption>Data source</caption> <description /> </property> using the above i am getiing something like: { "items": [ { "id": "some Mendix ref id" }, { "id": "some Mendix ref id" }, { "id": "some Mendix ref id" } ], "totalCount": 1, "hasmore": true, "status": "string", "offset": 0 } mydata is like: [ { "key": "value", "key2": "value2" }, { "key": "value", "key2": "value2" } ]         So, how to send data from Mendix to react-native widget using properties?         Could anyone Help us? Please find the following added screen shots The bellow screenshot is for sending the data into widget  in the html <Text>Mendix Data ----- {JSON.stringify(this.props.dates)}</Text> In the view the items key has the reference ids:  
asked
2 answers
1

The proper way to handle this in the pluggable widget API is to create properties with the attribute type with and dataSource tag. That’ll give you a function that takes a data item and returns an object with the value of the attribute. I don’t believe this portion of the API has been publicly released yet, so no documentation is available just yet.

answered
1

for each referenced id you can use the mx.data.get() method

mx.data.get(

   { guid: "123456",

  callback: function(obj) { console.log("Received MxObject with GUID " + obj.getGuid()); }

  });

or if you want to retrieve multiple in 1 call:

mx.data.get(

   { guids: [ "123456", "456789" ],

  callback: function(obj) { console.log("Received MxObject with GUID " + obj.getGuid()); }

  });

Note that the shown numbers should be variables.

answered