Here is one way...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:local="*" >
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private var dp:Array = [
{ symbol: "ADBE", name: "Adobe Systems Inc.", price:
49.95, url:"http://www.adobe.com"},
{ symbol: "CSCO", name: "Cisco Corp.", price: 15.95,
url:"http://www.cicso.com"},
{ symbol: "DELL", name: "Dell Computer Corp.", price:
60.95, url:"http://www.dell.com"},
{ symbol: "EXPA", name: "Expedia Travel.", price: 18.45,
url:"http://www.expedia.com"},
{ symbol: "FIDL", name: "Fidelity Investments.", price:
31.95, url:"http://www.fidelity.com"},
{ symbol: "GOOG", name: "Google", price: 125.95,
url:"http://www.google.com"},
{ symbol: "IBM", name: "IBM Corp.", price: 42.55,
url:"http://www.ibm.com"},
{ symbol: "INTL", name: "Intel Corp.", price: 46.95,
url:"http://www.intel.com"},
{ symbol: "MACR", name: "Macromedia Inc.", price: 39.95,
url:"http://www.macromedia.com"},
{ symbol: "MSFT", name: "Microsoft Corp.", price: 25.95,
url:"http://www.microsoft.com"},
{ symbol: "ORCL", name: "Oracle Corp.", price: 11.95,
url:"http://www.oracle.com"}
];
private function cellClicked(event:ListEvent):void
{
navigateToURL(new
URLRequest(event.currentTarget.selectedItem.url),"_blank");
}
]]>
</mx:Script>
<mx:DataGrid id="dg1" initialize="dg1.dataProvider = dp"
paddingTop="0" paddingBottom="0" verticalAlign="middle"
itemClick="cellClicked(event)">
<mx:columns>
<mx:DataGridColumn headerText="Name" dataField="name"
textAlign="left" width="180" itemRenderer="LinkRenderer"/>
<mx:DataGridColumn headerText="Symbol" dataField="symbol"
width="60" />
<mx:DataGridColumn headerText="Price" dataField="price"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
LinkRenderer.as:
package
{
import mx.controls.*;
import mx.controls.dataGridClasses.DataGridListData;
public class LinkRenderer extends LinkButton
{
private var fieldValue:String;
public function LinkRenderer()
{
super();
}
override public function set data(value:Object):void
{
if(value != null)
{
super.data = value;
fieldValue =
value[DataGridListData(listData).dataField];
label = fieldValue;
enabled = true;
useHandCursor = true;
setStyle("color", "#0000FF");
setStyle("textDecoration", "underline");
setStyle("textRollOverColor:", "#0000CC");
}
}
}
}
HTH
Steve
--- In [email protected], coder3 <rrhu...@...> wrote:
>
>
> Hi All,
>
> I need to show a list of information for the items in the
> datagrid/advancedDatagrid.
>
> the output text is ok but it contains a url that needs to be displayed
as a
> htmlLink so that when user clicks on it, the browser can goto that
url.
>
> for example it's like this:
>
> "....
> URL: www.nabble.com
> ..."
>
> Is there a way to do it?
>
> thanks
>
> C
>
> --
> View this message in context:
http://www.nabble.com/add-a-url-link-to-the-datagrid-datatip--tp26065104\
p26065104.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>