Problem with Image Link
Hi, i want to add a link to an image in a grid. The link is according the cell value. Also the cell have an image,text and background color according to a value. I made this code that puts the image and the text in the first column depending on the number of that cell. And also "puts" the link but it doesn't work, i mean, it applies the style of a link, it looks like it but when i click on it, doesn't do anything. Here's my code, please help me if you see the cause of this problem.
var myLinks = function(column, row)
{
if (this.getCellValue(column,row)<=50)
{
return "http://www.google.com";
}
else if (this.getCellValue(column,row)>=50)
{
return "http://www.yahoo.com";
}
}
var table = new AW.XML.Table;
table.setURL("XML-FILE.xml");
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(4);
obj.setRowCount(10);
obj.setSelectionMode("single-row");
obj.setCellModel(table);
obj.setCellTemplate(new AW.Templates.ImageText, 0);
table.getImage = function(col, row)
{
if (obj.getCellValue(0, row) > 50)
{
return "search";
}
else
{
return "favorites";
}
}
obj.defineRowProperty("Mybackcolor", function(row)
{return this.getCellValue(0, row)>50 ? "red" : "yellow";});
obj.getRowTemplate().setStyle("background-color", function()
{return this.getRowProperty("Mybackcolor");});
var link = new AW.Templates.Link;
link.setAttribute("target", "_new");
obj.setCellTemplate(link,0);
obj.setCellLink(myLinks);
document.write(obj);
var myLinks = function(column, row)
{
if (this.getCellValue(column,row)<=50)
{
return "http://www.google.com";
}
else if (this.getCellValue(column,row)>=50)
{
return "http://www.yahoo.com";
}
}
var table = new AW.XML.Table;
table.setURL("XML-FILE.xml");
table.request();
var obj = new AW.UI.Grid;
obj.setColumnCount(4);
obj.setRowCount(10);
obj.setSelectionMode("single-row");
obj.setCellModel(table);
obj.setCellTemplate(new AW.Templates.ImageText, 0);
table.getImage = function(col, row)
{
if (obj.getCellValue(0, row) > 50)
{
return "search";
}
else
{
return "favorites";
}
}
obj.defineRowProperty("Mybackcolor", function(row)
{return this.getCellValue(0, row)>50 ? "red" : "yellow";});
obj.getRowTemplate().setStyle("background-color", function()
{return this.getRowProperty("Mybackcolor");});
var link = new AW.Templates.Link;
link.setAttribute("target", "_new");
obj.setCellTemplate(link,0);
obj.setCellLink(myLinks);
document.write(obj);
Rauldinho
March 6,