How can I set value of an attribute when my data is coming from a datasource in a pluggable widget ?

0
Currently I'm facing this error - "Widget MainModule.MyCustomWidget is attempting to call "setValue". This operation is not yet supported on attributes linked to a datasource". I tried using `attr.get(object).setValue("some value")`. Apart from that I tried -  mx.data.get({ guids: guidArray, callback: objs => { objs.forEach(obj => { obj.set("_Id", rowIndex); }); } }); But even this is not modifying the "_Id". Are there any work arounds or any other way to fix this issue.
asked
2 answers
3

Yeah this is a long pending change that is needed to the Pluggable Widgets API. This has been missing since day 1. I always use the Client API to do this inside a pluggable widget.

 

Please find my long pending struggle with this issue via this forum post from some time ago which I update a couple of times:

 

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

 

The answer I got from support on this missing feature was that you can implement an action with that object / entity type as input parameter and save the changes in that action. 

This is indeed possible, but this runs async, meaning you won’t really know what the outcome of the action is and whether the save was successful.

 

This will cater for most scenarios though!

 

 

answered
0

Dug into the pluggable widget API docs, and found this: when a dataSource attribute is specified on a property type 'attribute', it is passed as a ListAttributeValue.

 

And, subsequently, this where it says: Due to a technical limitation it is not yet possible to edit attributes obtained via ListAttributeValue. EditableValues returned by ListAttributeValue are always readonly

 

This does not sound like a workaround or fix is feasible.

answered