Oh, forgot to add the code for a cell clicked event:

myDataGrid.addEventListener(ListEvent.ITEM_CLICK, cellClicked);

private function cellClicked(event:ListEvent):void
{
     if(event.columnIndex == 0) // Or whatever column you want
     {
         navigateToURL(new URLRequest('rediff.com'));  // Or whatever
     }
}


--- In flexcoders@yahoogroups.com, "valdhor" <valdhorli...@...> wrote:
>
> This is one of my itemrenderers:
>
> package Renderers
> {
>      import mx.controls.*;
>      import mx.controls.dataGridClasses.DataGridListData;
>      import mx.core.IFactory;
>
>      public class LinkCellField extends LinkButton implements IFactory
>      {
>          public function LinkCellField ()
>          {
>              super();
>          }
>
>          public function newInstance():*
>          {
>              return new LinkCellField ();
>          }
>
>          override public function set data(value:Object):void
>          {
>              if(value != null)
>              {
>                  super.data = value;
>                  label = value[DataGridListData(listData).dataField];
>                  enabled = true;
>                  useHandCursor = true;
>                  setStyle("color", "#0000FF");
>                  setStyle("textDecoration", "underline");
>                  setStyle("textRollOverColor:", "#0000CC");
>              }
>          }
>      }
> }
>
> And to use it:
>
> var newColumn:DataGridColumn = new DataGridColumn();
> newColumn.itemRenderer = new LinkCellField();
>
>
> HTH
>
>
>
> Steve
>
> --- In flexcoders@yahoogroups.com, guess what myworld100us@ wrote:
> >
> > eeks , I did that , the links dont appear .
> > This is my Code .
> >
> > for (var i:int=0;i<xlColumns.length();i++) { //loop over the xmlList
> > xmlColumn = xlColumns[i];
> > oColumnDef = new Object();
> > oColumnDef.dataField = xmlColumn.localName();
> > var urlItemRenderer: ClassFactory = new ClassFactory(urlRenderer) ;
> > oColumnDef.width = 100;
> > oColumnDef.itemRenderer = urlItemRenderer;
> > oColumnDef.sortable = true;
> > oColumnDef.visible = true;
> > oColumnDef.editable = false;
> > oColumnDef.wordWrap = false;
> > break;
> >
> >
> > urlRenderer.mxml
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:LinkButton xmlns:mx="http://www.adobe.com/2006/mxml";
> > label="Click On Me"
> > click="navigateToURL(new URLRequest('rediff.com'))"/>
> >
> >
> >
> >
> >
> > --- On Thu, 6/4/09, Tim Hoff TimHoff@ wrote:
> >
> >
> > From: Tim Hoff TimHoff@
> > Subject: [flexcoders] Re: Creating Link inisde a Data Grid Collumn
> > To: flexcoders@yahoogroups.com
> > Date: Thursday, June 4, 2009, 1:05 PM
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > If you're creating the column in AS, you'll need to use ClassFactory
> for the itemRenderer:
> > var urlItemRenderer: ClassFactory = new ClassFactory( com.myPath.
> urlRenderer) ;
> > urlItemRenderer. properties = { myItemRendererPubli cProperty:
> myProperty };
> > myColumnID.itemRend erer  = urlItemRenderer;
> > -TH
> >
> > --- In flexcod...@yahoogro ups.com, guess what <myworld100us@ ...>
> wrote:
> > >
> > >
> > > I want to show link inisde of my Data Grid Columnm . I know i
could
> use item renderer . if I try to use it directly in flex file it works
> fine, meaning if i have static columns ,Since my collumns are beeing
> built dynamicaly . I use action Script . I think I am doing soemthing
> wrong with the script . Can anyone help me .
> > >
> > > I assume this should be as simple as this . Should urlRenderer be
> Action script file or can anyone explain how do i do this .
> > > column.itemRenderer = urlRenderer
> > >
> >
>


Reply via email to