¿How can I select many items from a selec Item and add them to a Table Widget?
Hi all
I am a newbie at Bonita 7.2, and my doubt is:
I have a select of items with some researchers, and I want to select one of then, them push a button to add this to the Table widget. In the next step I want to select another different researcher from the select, and push again in the Add button and then automatically add this element to the same table widget, in this way I want to continue adding elements to this table Widget.
I have tried it with the field/property "Action" of the button, selecting the value "Add to a collection", and certainly it adds elements to the collection because I display it in a text field/JSON, but it doesn't display this values in the Table Widget.
This is the list mapped with the Table Widget
But the table is always empty.
I think I have to do something like these tutorials:
You can find an example on the link below, download and import the process.
https://github.com/Bonitasoft-Community/vacation-management-example
Basically, it uses the "selected row" variable from the table, and a request to the business object with the "context" of the task.
It works well.
If you want to create your own customized request within Bonita Engine, take a look at the following link :
https://github.com/Bonitasoft-Community/rest-api-sql-data-source
EDITED, New Information:
Sorry, let me explain better, the table does add new row, but this new row is empty, I suppose it is because the list that I am passing to the Table is a simple list like this:
And I think it should be something like this to make it work:
{
"name": "Pedro Rodríguez Méndez"
},
{
"name": "Luis Concepción del Castillo"
}
]
I think it is mandatory, a must, to give a hashMap to the table Widget, in the json, with the structure:
[{"key":"value1"},{"key":"valu2"}]
Thank you very much.
Any assistance would be greatly appreciated.
Kind regards,
Héctor
Comments
To add this code, I have to create my own custom button widget, because in a common button oi can't add any code.
I suppose I have to take the generic widget of a button and add this code that you say.
Am I wrong?
Thank you very much
Sorry, let me explain better, the table does add new row, but this new row is empty, I suppose it is because the list that I am passing to the Table is a simple list like this:
And I think it should be something like this to make it work:
{
"name": "Pedro Rodríguez Méndez"
},
{
"name": "Luis Concepción del Castillo"
}
]
I think it is mandatory, a must, to give a hashMap to the table Widget, in the json, with the structure:
[{"key":"value1"},{"key":"valu2"}]
Thank you very much
Do you mean I have to add an api rest extension to add this element by the API Rest to the list(Process variable)? and then refresh the table in the view with the new element.
Thank you very much
Thank you, perfect, I copied the code from: http://localhost:8080/designer/#/es/widget/pbButton
The code of a common button, and then I added the code of "Sean McP".
I also have to add this in the field values to add:
{"nombre":investigador}
Because the table need a JSON with {"key": "value"}
Thank you very much
Is there a better way of doing it?