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
February 22,
var data = new AW.XML.Table;
data.setURL("image-element.xml");
data.setColumns(["rank", "country", "users", "year", "code"]);
data.request();
// add getImage method returning 'image' column value
data.getImage = function(col, row){
return this.getData(4, row); // image in the 5th column (as defined in XPath)
}
var grid = new AW.UI.Grid;
grid.setId("myGrid");
grid.setCellTemplate(new AW.Templates.ImageText, 1); // image & text template for the 2nd column
grid.setColumnCount(4);
grid.refresh();
// attach external data model
grid.setCellModel(data);
var data = new AW.XML.Table;
data.setURL("image-attribute.xml");
data.request();
// add getImage method returning 'code' attribute for each node
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); // image & text template for the 2nd column
grid.setColumnCount(4);
grid.refresh();
// attach external data model
grid.setCellModel(data);
This topic is archived.
ActiveWidgets is a javascript library for creating user interfaces. It offers excellent performance for complex screens while staying simple, compact and easy to learn. Deployed by thousands of commercial customers in more than 70 countries worldwide.
Copyright © ActiveWidgets 2021