PDA

View Full Version : display image in templates



myput
13 Oct 2011, 5:22 AM
Hello,

I load a template by the way of a function in my globals.js:


function loadURL(url) {
var oRequest = new XMLHttpRequest();
oRequest.open('GET', url, false);
oRequest.setRequestHeader("User-Agent", navigator.userAgent);
oRequest.send(null);

return oRequest.responseText;
};


and for exemple, in my view, i load this template:


tpl: loadURL(host + 'WPApp/app/views/ModuleDirectory/templates/DirectoryInformationsPanel.html'),


In this template, i can access to all my store data, {name} etc ...
But i have an Image link, in my store,
and in the template DirectoryInformationsPanel.html, i load like that the image:


<img src={icon} title="thumb" style="float:right;">

and it doesn't work.

Before, i loaded the image directly in the view, by

tpl: '<img src={icon} title="thumb" style="float:right;"> '
and it worked.

How can i fixed it ?
thanks for help :)

myput
17 Oct 2011, 7:47 AM
I think the link is good because i have the little thumb: [?] image but i don't know how to do the link.
It's maybe because i work in localhost ?

myput
19 Oct 2011, 7:50 AM
That's strange,

Display image by template work in a simple template in dataView, and in list too ...
But Don't work in a nestedList ...
Before template, i could display this one without template ...


i checked some times my code and url in the browser give me the good image, then the link is good ...

What is wrong with the code ? or it can be a bug ?

Thanks for help