If you want a clickable link, you'll want to set up the labelFunction of the DataGrid, which would look something like thisprotected function formatURL(item:Object, column:DataGridColumn):String {
column.itemRenderer = null;
if (column.dataField == "URLData" ) {
column.itemRenderer = new ClassFactory(UrlLinkButton);
return item.URLData;
}
else if (column.dataField == "Name") // set up checks for other field names
return item.Name;
else
return "ERR: No Field name defined";
}With an ItemRenderer for your field that could look like this.<?xml version="1.0" encoding="utf-8"?>
<mx:LinkButton xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
fontWeight="bold"
color="#0000FF"
label="{data.URLData}"
click="openURL()">
<fx:Script>
<![CDATA[
/**
* Function that will parse current date and given URL info into a url string to be opened in a new page.
**/
protected function openURL():void {
trace("button clicked, attempt to parse to URL");
if (data.URLData) {
// concatenate url string
var url:String = "url information" + data.URLData + "maybe more url information";
trace("send drawing url request");
navigateToURL(new URLRequest(url));
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</mx:LinkButton>This way, the URL opens only if they click in that field.Of course you could bypass the ItemRenderer and use the openURL() on an ItemClickEvent if you don't mind that the URL will open when they click the row in the DataGrid.