:: Forum >>
XML & Cell Image
hi, i'm havin trouble displaying an image in a cell using XML as my data source. Can someone post a code that shows the right way to do so please. I need help on this one!!! :(
Rauldinho
Thursday, February 22, 2007
finally got it.... thanks for nothing :P just kidding guys! jeje
Rauldinho
Thursday, February 22, 2007
You have to add getImage() method to your XML datasource.
Option 1 - the image code is in another column (element).
Add the image column to the XPath (as a last one). Return the last column value from the getImage() method -
var data = new AW.XML.Table;
data.setURL("image-element.xml");
data.setColumns(["rank", "country", "users", "year", "code"]);
data.request();
data.getImage = function(col, row){
return this.getData(4, row);
}
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setCellTemplate(new AW.Templates.ImageText, 1);
grid.setColumnCount(4);
grid.refresh();
grid.setCellModel(data);
Option 2 - the image code is in the node attribute.
Add getImage() method which retrieves the node attribute -
var data = new AW.XML.Table;
data.setURL("image-attribute.xml");
data.request();
data.getImage = function(col, row){
return this.getNode(col, row).getAttribute("code");
}
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setCellTemplate(new AW.Templates.ImageText, 1);
grid.setColumnCount(4);
grid.refresh();
grid.setCellModel(data);
Alex (ActiveWidgets)
Thursday, February 22, 2007
Oops, too late :-)
Alex (ActiveWidgets)
Thursday, February 22, 2007
This topic is archived.
Back to support forum
Forum search