function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jthor@entransform.comjthor@entransform.com 

Rich text image and sencha

Hello,

       

         So I was able to query the image from salesforce and it returned me a string.When I click on the link it takes me to a page but there is no image. I checked the link of the image and they are the same except the URL that salesforce gave me via soql query added the "&"  to the URL. How do I get rid of that? Also when I set the HTML of an image component from sencha it interprets the tags as a string and display the HTML code instead of the image. When i try to set the source of the image component it adds looks for the image in static resource using the URL as the path name to the resource. Sorry about all the question, but  am at a dead end.

Best Answer chosen by Admin (Salesforce Developers) 
Gaurav KheterpalGaurav Kheterpal

You should be using panel instead of directly using the image. You can then use the setHtml() function as illustrated below.

 

View

 

    xtype : 'panel',
    id : 'speakerImage',
    html : '<div style="text-align: center; padding-top:10px;"><img style="height: 120px; width: 100px; text-align:center;" src="resources/images/professional.png" /></div>'
   },

 

Controller

 

Get the URL from JSON as follows

 

var imagePath = Por.Util.getImagePath() + responseData.data.reference[0].photo;

 Finally, set the HTML as follows

 

Ext.ComponentQuery.query('panel[id=speakerImage]')[0].setHtml("<div style='text-align: center; padding-top:10px;'><img style='height: 120px; width: 100px; text-align:center;' src=" + imagePath + " /></div>");

 

I use this frequently and it works well. I hope this helps.


Gaurav

All Answers

Gaurav KheterpalGaurav Kheterpal

You should be using panel instead of directly using the image. You can then use the setHtml() function as illustrated below.

 

View

 

    xtype : 'panel',
    id : 'speakerImage',
    html : '<div style="text-align: center; padding-top:10px;"><img style="height: 120px; width: 100px; text-align:center;" src="resources/images/professional.png" /></div>'
   },

 

Controller

 

Get the URL from JSON as follows

 

var imagePath = Por.Util.getImagePath() + responseData.data.reference[0].photo;

 Finally, set the HTML as follows

 

Ext.ComponentQuery.query('panel[id=speakerImage]')[0].setHtml("<div style='text-align: center; padding-top:10px;'><img style='height: 120px; width: 100px; text-align:center;' src=" + imagePath + " /></div>");

 

I use this frequently and it works well. I hope this helps.


Gaurav

This was selected as the best answer
jthor@entransform.comjthor@entransform.com

Your Amazing Thank you.