I am mapping a JSON response to a grid. My json returns also a url to load img for each item. Where should I add the code to get the url after the grid is populated, read each image and place it in the right position in the grid?
Thanks
Roger
I am mapping a JSON response to a grid. My json returns also a url to load img for each item. Where should I add the code to get the url after the grid is populated, read each image and place it in the right position in the grid?
Thanks
Roger
Hello! It depends on data you retrieve and the way you need to upload images. You can add JS in mapping or map URL to hidden field and then on service Success check response and upload images.
So here what I tried without success. I added JS to the asset property of the image component. Value contains the image name returned from JSON
function(value,element){
var i=new Image();
i.src='http://example.com/pics/'+value;
return i;
}
If I open a browser to the link I get the correct pics. Any suggestions? All pics are in the jpeg format.
Thanks
Roger
If you have image name and you just need to add path to that image - in mapping to image asset add the following code:
codereturn 'http://example.com/pics/'+value;/code
Thanks Marina. It works!