Simple Link in XML Grid

All I want to do is make each item the fourth column in my grid be a link to some external webpage. I don't know why, but I just simply can't figure it out.

//	define data formats
    var str = new AW.Formats.String;
    var link = //What goes here?!
        obj.setCellFormat([str, str, str, link]);

    //	provide external model as a grid data source

    //	write grid html to the page
June 8,
Paul, I do it like this for some of our documents that would be links You would do the same thing for html pages:

"Division", "Department", "Band", "JobDescFileName"

"IS", "WebDev", "II", "web_band_ii.html"
"IS", "WebDev", "III", "web_band_iii.html"

So, you'd set up the grid as normal - and for the "JobDescFileName" column, the grid would display "web_band_ii.html" --- but what you would want to do is in the javascript:

obj.setCellText(function(col,row) {
return "<a target='_blank' href='jobs/" +
this.getCellValue(3, row) + ".drf'>" +
this.getCellValue(3, row) + "</a>";

What it does is turn what displays in the grid cell into a link. You do have to watch the construction of the html code and match up single and double quotes correctly. But it does work - I also use this method to dynamically set images in the cells based on a cell value.

If you need help, let me know.
June 13,

This topic is archived.

See also:

Back to support forum