If you are usign VOs, why not just add properties and have the VO do the
calculation internally, and forget the labelFunctions entirely?

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Sefi Ninio
Sent: Friday, August 22, 2008 2:26 PM
To: [email protected]
Subject: Re: [flexcoders] Re: DataGridColumn trouble...

 

Hi Tim.

I'm not worried about duplicating code, the calculations are already
implemented in a different function, since the first two label function
use them. I want to save the computing time of doing the calculations
again...

And I do want to look at the datagrid and not the data (unless I'm
missing something).
The data is raw - meaning it is the data prior to the calculations.
I want to have the data after the computations, and use it in the third
labelFunction...

I'll try and explain a bit more the situation (a bit simplified):

The raw data in the DataGrid dataprovider is VOs with various members,
Dates among them.
The second column displays the startDate after calculations (made in the
second column's labelFunction).
The third column displays the endDate after calculations (made in the
third column's labelFunction).
The forth column should display a value based on the data of the second
and third columns, but I need the values AFTER the calculations and not
the raw data. That is why I need the data in the datagrid columns
themselves (since they are the computed data) and not the raw data in
the dataprovider...

Hope that makes the situation clearer, hopefully will help you guys help
me :)

Thanks,
Sefi

On Fri, Aug 22, 2008 at 7:42 PM, Tim Hoff <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> > wrote:


You don't want to look at the grid, you want to look at the data. My
suggestion would be to pull the complex calculations out of the label
functions and put them in seperate functions; that are called by the
label functions. That way ou can re-use the calculations where needed,
and not worry about duplicating code.

-TH



--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Sefi Ninio" <[EMAIL PROTECTED]> wrote:
>
> Bump...
>
> Anyone? I'd appreciate any input or pointers to links...
>
> Thakns,
> Sefi
>

> On Fri, Aug 22, 2008 at 9:34 AM, Sefi Ninio [EMAIL PROTECTED] wrote:
>
> > Hi Tracy,
> >
> > I know I get the Item, and that's what I currently use.
> > The problem is (and I probably should have mentioned it), that the
other
> > columns labelFunctions make a complex calculation themselves, and I
am
> > reluctant to do it again in the third column labelFunction if
there's a way
> > to get to the already calculated values within the DataGrid.
> >
> > I also thought of keeping the calculation results in an external
map, but
> > there must be a simpler solution...
> > I can't believe there is no way to get from the DataGridColumn to
the grid
> > itself.
> >
> > Sefi
> >
> >

> > On Fri, Aug 22, 2008 at 2:53 AM, Tracy Spratt [EMAIL PROTECTED]:


> >
> >> labelFunction gets two arguments. One is a reference to the
*entire*
> >> dataProvider item, the other to the dataGridColumn. Since you have
a
> >> reference to the whole item, you can easily build your return
string.
> >>
> >>
> >>
> >> Tracy
> >>
> >>
> >> ------------------------------
> >>
> >> *From:* [email protected]
<mailto:flexcoders%40yahoogroups.com> 
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] *On
> >> Behalf Of *Sefi Ninio
> >> *Sent:* Thursday, August 21, 2008 4:15 PM
> >> *To:* [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> >> *Subject:* [flexcoders] DataGridColumn trouble...
> >>
> >>
> >>
> >> Hi.
> >>
> >> I have a DataGrid, and a few DataGridColumns in it.
> >> One of them has a labelFunction, that should return a value that
depends
> >> on the values of two of the other columns.
> >>
> >> example:
> >> | name | start | end | diff |
> >> | xxx | 5 | 7 | 2 |
> >> | yyy | 10 | 100 | 90 |
> >>
> >> etc...
> >>
> >> I can't find a way to get a reference to the DataGrid or the other
> >> DataGridColumns inside it from the labelFunction - using it's
DataGridColumn
> >> argument...
> >>
> >> Any help would be greatly appreciated..
> >>
> >> Sefi
> >>
> >>
> >>
> >
> >
>

 

 

Reply via email to