:: Forum >>

Creating a link in a column?

Assuming the following XML:
<root>
<row AccountID="1" AccountNumber="1001"/>
<row AccountID="2" AccountNumber="1002"/>
</root>


How can I make a link in the grid using the AccountID column (column 0) as part of the HREF URL and the AccountNumber column (column1 1) as the HREF text?

There are no examples in the documentation, and all of the answers in the forum appear to be for version 1.
Duane Roelands
Friday, June 9, 2006
To display a link you need to assign a link template to the cell and put url to cell link property. With external XML data source you can just add getLink(col, row) method. The simplest way would be defining additional data column and returning this column value as URL -

var table = new AW.XML.Table;
table.setURL("test.xml");
table.setColumns(["@AccountID", "@AccountNumber"]);
table.getLink = function(col, row){
return "/staticURLpart" + this.getData(0, row);
}
table.request();

var obj = new AW.UI.Grid;
obj.setColumnIndices([1]);
obj.setColumnCount(1);
obj.setCellTemplate(new AW.Templates.Link, 1);
obj.setCellModel(table);
document.write(obj);
Alex (ActiveWidgets)
Monday, June 12, 2006

This topic is archived.


Back to support forum

Forum search