Dude, my emails are slow as nuts to this list...
 
*ahem*
 
Try this for your click event:
 
listOwner.dispatchEvent({type: "hyperlinkClick", target: listOwner, cell: this, text: cellData});
 
That way, if anyone subscribes to the DataGrid's "hyperlinkClick" event, they'll get that event, with all the needed data.
 
 
----- Original Message -----
From: isidrolv
Sent: Friday, June 17, 2005 1:16 PM
Subject: [flexcoders] Link as a CellRender for a DataGrid

Hi, everybody!

 

I traed to build a CellRenderer using Link control, for use in a DataGrid, but i don?t know how to broadcast the click event of the Link, and to be listened in the app using the DataGrid.  In other words, I need to catch the click event of the renderer, inside my app. What I must do?

 

This is a section of the code using my renderer:

<mx:DataGrid id="dgBalance" dataProvider="{balanceGeneral}" width="100%" height="100%" sortableColumns="false" cellPress="doCellPress(event);">

             <mx:columns>

               <mx:Array>

                  <mx:DataGridColumn headerText="CONCEPT" columnName="CONCEPT" width="350" resizable="true" />

                  <mx:DataGridColumn headerText="TOTAL" columnName="t1"  textAlign="right" cellRenderer="MyRenderer" />

 

?..------------------------------????..

 

The code of the CellRenderer:


<?xml version="1.0" encoding="utf-8"?>

<mx:Link xmlns:mx="http://www.macromedia.com/2003/mxml" click="mx.controls.Alert.show('Drill Down Cell')" >

<mx:Script>

            <![CDATA[

           

           

           

            var listOwner : MovieClip; 

            var getCellIndex : Function; 

            var        getDataLabel : Function;

 

            function setValue( str:String, item:Object, sel:Boolean ) : Void

            {          

                        var value = item[getDataLabel()];

                        this.label = value;

                        var num:Number = parseFloat(value);

                        trace(num)

                        if (num<0) {

                                    this.setStyle("color","#FF0000");

                                    this.setStyle("fontWeight","");

                        } else {

                                    this.setStyle("color","");

                                    this.setStyle("fontWeight","");

                        }

            }

           

            ]]>

</mx:Script>

</mx:Link>

 

 

 

Thanks for your help

 

Isidro.



Yahoo! Groups Links

Reply via email to