Home > Software design >  ExtJS Background image from API
ExtJS Background image from API

Time:08-03

How could I display an image in ExtJS downloaded from our API? At the moment we are using XTemplate or HTML for pdf documents but this makes a call in our API without the Authorization header.

I need to do it using XHRRequest or Ajax to be able to include to authorization token.

CodePudding user response:

You can try to use Ext.Img and append the token to the url:

var wrappedImage = Ext.create('Ext.Img', {
   src: 'http://www.sencha.com/img/20110215-feat-html5.png?token=YOUR_TOKEN',
   autoEl: 'div', // wrap in a div
   renderTo: Ext.getBody()
});
  • Related