2 Replies Latest reply on Aug 16, 2015 10:05 PM by jaeyan RSS
    jaeyan Explorer

    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.

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

        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?
            jaeyan Explorer

            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[i].UUID
                var params = {     values: values /* INFOTABLE*/ };
                Things["TEST_INFO"].DeleteDataTableEntry(params);
            }

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