I am retrieving customers from an external DB and add them in a select widget then one is selected and the data is displayed in widgets on a form.
It works fine for inputs widgets and they easily display what I tell them but antother select widget that lists available titles (Dr., Monsieur, Madame) is not displaying the title value of the selected customer.
Even more, this select widget is stuck on the last value (Madame) in the list and doesn’t allow me to choose any other.
Note that I didn’t use “Displayed key” and “Returned key” (didn’t use a map) but simply “Available values” (a simple list). But it should also be fully functional if you are using “Displayed key” and “Returned key”.
I also managed to successfully update the select widget with customer title after selection of a customer in the other select widget.
I finally was able to do it as I previously gave wrong value to the ‘returned key’ and ‘value’ propreties.
For this case, the available values for the title widget were hardcoded in a json variable following the pair “label”:“value” format.
However, I have another case about devices and deviceGroups following quite a similar pattern as the one with the customer and its title.
When a List<data.model.deviceGroup> is used to populate the select (where deviceGroup is not organized following the “label”:“value” pair) the behavior seems different.
The widget is correctly populated with retrieved deviceGroups but doesn’t display the deviceGroup of the selected device
The “displayed key” is “name”.
The “returned key” is empty and even if it is empty, it definitly does update the formInput.device.deviceGroup variable bound to the “value” property of the select widget but it doesnt display the deviceGroup of the selcted device.
The “available values” is bound to List<data.model.deviceGroup>.value wich returns a json array.
Here is a sample of how the List<data.model.deviceGroup>.value ends up and is passed to the widget.
[
{
“persistenceId”: null,
“persistenceVersion”: null,
“enumeration”: 1,
“kind”: 4004,
“code”: null,
“name”: “Imagerie mobile”
},
{
“persistenceId”: null,
“persistenceVersion”: null,
“enumeration”: 2,
“kind”: 4004,
“code”: null,
“name”: “Echographie”
}
]
Right that’s it. It is a kind of identical pattern than with the customer and the customer’s title.
But you can figure it out in the device task of the project that you allready downloaded from another thread.
Actually I have a question regarding your data model.
You use a composition between the Device and the DeviceGroup. Composition means that if you delete the Device you will delete in cascade the DeviceGroup. I’m assuming that this is not what you want and so that aggregation would be more appropriate for your use case. Is that correct?
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.