cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass multi selected rows parameter in the grid to a service?

Regular Member

How to pass multi selected rows parameter in the grid to a service?

I would like to delete selected rows in the grid. But, I can't find how to pass selected rows parameter to a service.

Please advise to me if anyone already have this experience to solve this problem.

Thanks in advance.

2 REPLIES 2

Re: How to pass multi selected rows parameter in the grid to a service?

Hi

The best option is probably to configure the service you're using to delete the rows to have an InfoTable input parameter with the same DataShape as the service that provides the data to the grid. In your service, loop through the input InfoTable and delete the matching rows in the source data.

If you're only doing a single selected row at a time, then you can use SelectedRow(s), <PropertyName> as input to your delete service. There's examples for this in the Introduction to ThingWorx course material.

Regards

Ian

Re: How to pass multi selected rows parameter in the grid to a service?

Thank you very much lan.

According to your advice, I did it. For others, I leave here my service code.

Input : Infotable     /*SelectedRows in the grid*/

Output : Nothing

===================================================================

var values = Things["TEST_INFO"].CreateValues();


for(var i = 0; i < SelectedRows.length; i++) {
    values.UUID =  SelectedRows.UUID
    var params = {     values: values /* INFOTABLE*/ };
    Things["TEST_INFO"].DeleteDataTableEntry(params);
}

===================================================================