Thanks Dirk,

It worked perfectly. Now I understand how important delegate is
important and how to use it.

Jo�o Fernandes

--- In [email protected], "Dirk Eismann" <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> looking at your code snippet it seems as if you're not invoking the
constructor function of the DataGridColumn class:
> 
>   > var DataGridColumn = new mx.controls.gridclasses.DataGridColumn;
> 
> try this instead:
> 
>   var dataGridColumn = new mx.controls.gridclasses.DataGridColumn();
> 
> To assign a labelFunction to the newly created instance use the
Delegate class
> 
>   dataGridColumn.labelFunction = mx.utils.Delegate.create(this,
myLabelFunc)
> 
> The function myLabelFunc will then be used as the labelFunction, i.e.
> 
>   function myLabelFunc(item:Obejct):String {
>     return "Howdy!";
>   }
> 
> Dirk.
> 
> 
> > -----Original Message-----
> > From: joao_m_fernandes [mailto:[EMAIL PROTECTED]
> > Sent: Monday, April 11, 2005 3:51 PM
> > To: [email protected]
> > Subject: [flexcoders] Re: Dynamic DataGridColumns & LabelFunction
> > 
> > 
> > 
> > 
> > 
> > Well what I want is to be able to assign labelFunction dynamicly.
> > Depending on a selection I build an array of columns wich some have
> > labelFunctions to format de data.At the end I replace current columns
> > by the new array. 
> > 
> > If I define a fixed column in a dg whe labelFunction set I can watch
> > the object trought debugger and get this sctructure
> > 
> > dg.__columns[someindex].__labelFunction{object}
> > 
> > > __proto__
> > > constructor
> > > func
> > > prototype
> > > target
> > 
> > When I try to simulate the same behavior with AS 
> > 
> > <!------------------------>
> > var colunas:array = new Array();
> > var DataGridColumn = new mx.controls.gridclasses.DataGridColumn;
> > DataGridColumn.columnName = "data_fim";
> > DataGridColumn.__header = "At�";
> > DataGridColumn.labelFunction= {func:eurodate,target:this};
> > DataGridColumn.textAlign = "center";
> > colunas.push(DataGridColumn);       
> > // eurodate beeing the function I want to be used and colunas the new
> > array to be used by the dg. 
> > dg.columns = colunas;
> > <!------------------------>
> > I get the following object 
> > 
> > > __proto__
> > > constructor
> > > func
> > > target 
> > 
> > no prototype is defined for this object. Is this the approach to build
> > with actionScript a dgcolumn?
> > 
> > Regards,
> > 
> > Jo�o Fernandes
> > --- In [email protected], "Andrew Spaulding" 
> > <[EMAIL PROTECTED]> wrote:
> > > 
> > > mmm i would have assumed that the simple dot notation of
> > > mycolumn.labelFunction = myFunction; should have called the 
> > set method
> > > on the DataGridColumn.
> > > 
> > > maybe do it this way??
> > > 
> > > mycolumn.labelFunction = Function()
> > > {
> > > //do the do here
> > > }
> > > 
> > > i'm not sure .. just guessing!
> > > 
> > > Andrew
> > > 
> > > 
> > > 
> > > 
> > > --- In [email protected], "joao_m_fernandes"
> > > <[EMAIL PROTECTED]> wrote:
> > > > 
> > > > Hi there,
> > > > 
> > > > I'm populating a DataGrid and from user selection, 
> > columns are added
> > > > and removed. Everything works fine excepting defining a 
> > labelFunction
> > > > to a column.
> > > > I'm using this code to define a new column and the 
> > function to be used
> > > > eurodate.
> > > > 
> > > > var DataGridColumn = new mx.controls.gridclasses.DataGridColumn;
> > > > DataGridColumn.columnName = "data_fim";
> > > > DataGridColumn.__header = "At�";
> > > > --->>> DataGridColumn.__labelFunction = eurodate();
> > > > DataGridColumn.textAlign = "center";
> > > > colunas.push(DataGridColumn);           
> > > > 
> > > > I tried:
> > > > DataGridColumn.labelFunction = eurodate();
> > > > DataGridColumn.labelFunction = eurodate;
> > > > DataGridColumn.__labelFunction = eurodate();
> > > > DataGridColumn.__labelFunction = eurodate;
> > > > 
> > > > none worked.
> > > > Any Clue?
> > > > 
> > > > Thanks,
> > > > Jo�o Fernandes
> > 
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links
> > 
> > 
> > 
> >  
> > 
> > 
> > 
> >





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to