xml - (images in grid III)
Am having difficulty displaying images in the grid when loading data from an xml file. Am wondering if somebody has done this who wouldn't mind posting their implementation code?
eddyoc
February 23,
var table = new Active.XML.Table;
var grid = new Active.Controls.Grid;
if (!window.My) My=[];
if (!My.Templates) My.Templates=[];
My.Templates.Image = Active.System.Control.subclass();
My.Templates.Image.create = function(){
var subClass = this.prototype;
subClass.setClass("templates","image");
var image = new Active.HTML.IMG;
image.setAttribute("src",function(){return this.getItemProperty("text");});
image.setAttribute("align","middle");
subClass.setContent("image", image);
};
My.Templates.Image.create();
// create data formats
var string = new Active.Formats.String;
date.setDataFormat("ISO8061");
// create ActiveWidgets data model - XML-based table
// provide data URL
table.setURL("//:server/somexml?");
//set rows XPath
table.setRows("//securities/*");
//set columns XPath
table.setColumns(["name","symbol", "currency", "priceDateRange"]);
//set column formatting
table.setFormats([string, string, null, string]);
//start asyncronous data retrieval
table.request();
var columns = ["Company Name", "Sym", "Curr", "Data Range"];
grid.setColumnTemplate(new My.Templates.Image, 2);
grid.setColumnProperty("texts", columns);
document.write(grid);
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