View Full Version : Setting img src from the Global javascript variable at the runtime

8 Oct 2014, 2:09 AM

I am using ExtJs 4.2.1 and SA 3.1. I have a LogoContainer which contains an image element. The src of the image (Logo) will come from the server config. So basically, when the index.html is called via the parent jsp, the src (location) of image will be passed based on the url/domain, user has selected to load. How can i achieve this? I couldn't find any way of doing this.

This LogoContainer is included in every View of the application and the viewport is of card layout switching views on the fly.

The problems i am facing are:
1. In SA3, i can't have an img component without a src attribute.
2. I can have a utility singleton class having the global variable with value of image location. But how to set this global variable on the runtime/launch time from the JSP.

basic premise of the requirement is to map image locations to the domain names in the server and user can launch the Extjs app with any of the configured domains (thus changing the logo) and no code change required on the ExtJS (client) side.

Any help is appreciated.

Thanks & Regards,

9 Oct 2014, 9:29 AM
Set the image to an initial blank image, Set the src to the correct image when loading the page.