Page 1 of 1

Mapping request params from list item

Posted: Fri May 23, 2014 4:09 pm
by Abu Ali

hi,
on the btnLike i am invoking a service with the following mapping

Image

mobilelistitem_43 is mapped already in other service to show an array of facebook feed and it works fine
and this is the mapping

Image

my problem that the request param "object-id" is always takes the first item in the results array.

what did i miss ?

thanks


Mapping request params from list item

Posted: Fri May 23, 2014 7:08 pm
by Kateryna Grynko

Hi Abu,

This is because you cannot map an array of UI components as request parameters. To do this add a service GetEventFeeds Success event handler:prevar arr = [];
$(data).each(function(){
arr.push(this.id);
});
localStorage.setItem("arr", JSON.stringify(arr));/preThis saves an array of IDs to a localStorage variable 'arr'.

Then in service LikeAPost add the following JS code to a parameter 'object-id':prereturn localStorage.getItem("arr");/pre
Finally, you'll have a mapping of array of IDs to a parameter 'object-id'.


Mapping request params from list item

Posted: Fri May 23, 2014 7:35 pm
by Abu Ali

thanks for your reply, but i want to map only the corresponding id to the listitem containing the btn not the whole array

Image


Mapping request params from list item

Posted: Fri May 23, 2014 7:35 pm
by Abu Ali

Mapping request params from list item

Posted: Fri May 23, 2014 9:22 pm
by Kateryna Grynko

Hi Abu,

Run this code on button Click event:prevar text =
$(this).parents()find("[name=labelName]").text();
localStorage.setItem("text", text);/pre
And then run the following JS on request parameter 'object-id' mapping:prereturn localStorage.getItem("text");/preWhere 'labelName' is a name of the label where you store ID.


Mapping request params from list item

Posted: Sat May 24, 2014 5:35 am
by Abu Ali

it is not handling my input control on btn event

this line return "" always
var text =$(this).parents().find("[name=txtPostID]").text();

can you check it plz? my account is a href="mailto:ana.wzghir@gmail.com" rel="nofollow"ana.wzghir@gmail.com/a

thanks


Mapping request params from list item

Posted: Sat May 24, 2014 6:18 am
by Abu Ali

it works by applying this on btn click event

var text =
$(this).parent().find("[name=txtPostID]")[0].value;
localStorage.setItem("postid", text);

thanks