3.2.0

XML Grid with Image

Hi, i'm making a grid that reads from a XML file and depending on the value of a cell, it puts an image (High, Normal, Low). Now i know that this has been discused many times in this forum (http://www.activewidgets.com/javascript.forum.14583.2/how-do-i-add-an.html), but the solution it's not working for me, and i read lots of more post and still nothing. Here's my piece of code:

<style type="text/css" >
.aw-image-favorites {background: url(favorites.png)}
</style>
....
<script>
var table = new AW.XML.Table;
table.setURL("XMLfile.xml");
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(4);
obj.setCellModel(table);
document.write(obj);
</script>


I tried using the obj.setCellImage("favorites", 1, 1); but i doesn't work, it just display the grid without any image. Sorry if i wrote too many, i just want to make myself clear. Thanks for any help in advanced!!
Rauldinho
February 19,
You also have to use either AW.Templates.Image or AW.Templates.ImageText. By default the grid uses AW.Templates.Text template for the cells and that one does not show images.
Alex (ActiveWidgets)
February 19,
Hi Alex, thanks for answering. So i add this to the code and still nothing

<style type="text/css" >
.aw-image-favorites {background: url(favorites.png)}
</style>
....
<script>
var table = new AW.XML.Table;
table.setURL("XMLfile.xml");
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(4);
obj.setCellModel(table);
obj.setCellTemplate(new AW.Templates.ImageText,0);
obj.setCellImage("favorites", 0);

document.write(obj);
</script>

....and still nothing. I tried this on a table with data loaded from a javascript array and it worked. Does it have anything to do with the fact that the data is loaded from a XML file??? i found this post http://www.activewidgets.com/javascript.forum.560.5/xml-images-in-grid-iii.html and i will read it, but if you can help me with this i would really appreciate it, thanks!!!
Rauldinho
February 20,

This topic is archived.

See also:


Back to support forum