I hear you Sefi, However, looking at the DataGrid is like the "tail wagging the dog". The DataGrid is nothing more than a representation of the data, calculated or not. Not only might it be a bit backwards, but you may run into a race condition, by looking at what is displayed in the DataGrid, as opposed to calculating the required column values again in the diff column. Also, not all rows that are in the DataProvider exist in the DataGrid; because of itemRenderer recycling.
Regardless, what I'm saying is similar to Tracy's suggestion; either reuse the needed column calculation methods in the diff label function (I can't imagine that this would add much overhead), pre-calculate the column fields in your VO's, or derive a seperate collection from the raw data; to be used for the dataProvider of the DataGrid. Just a few suggestions, -TH --- In [email protected], "Sefi Ninio" <[EMAIL PROTECTED]> wrote: > > 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] 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] <flexcoders%40yahoogroups.com>, "Sefi > > Ninio" sefi.ninio@ 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 sefi.ninio@ 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] <flexcoders%40yahoogroups.com> > > [mailto:[email protected] <flexcoders%40yahoogroups.com>] *On > > > >> Behalf Of *Sefi Ninio > > > >> *Sent:* Thursday, August 21, 2008 4:15 PM > > > >> *To:* [email protected] <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 > > > >> > > > >> > > > >> > > > > > > > > > > > > > > > > > >

