Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-------- Single Attachment Version ---------------->
- var html='';
- for(var i = 0; i<result.sObjects.length;i++)
- {
- var imageId = 'default image id here';
- if(result.sObjects[i].hasOwnProperty('Attachments'))
- {
- imageId = result.sObjects[i].Attachments[0].Id;
- }
- html += '<li><img class="cacheable" id="'+imageId+'">'+result.sObjects[i].Name+'</li>';
- }
- $('#products').html(html);
- <!--------- All attachments version ------------------->
- var html='';
- for(var i = 0; i<result.sObjects.length;i++)
- {
- var imageId = 'default image id here';
- html += '<li>'+result.sObjects[i].Name;
- if(result.sObjects[i].hasOwnProperty('Attachments'))
- {
- html += '<ul>';
- for(var i = 0; i < result.sObjects[i].Attachments.length; i ++)
- {
- html += '<li><img class="cacheable" id="'+result.sObjects[i].Attachments[0].Id+'">'+result.sObjects[i].Name+'</li>';;
- }
- html += '</ul>'
- }
- html += '</li>'
- }
- $('#products').html(html);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement