From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Hoff
Sent: Monday, October 23, 2006 6:40 PM
To: [email protected]
Subject: [flexcoders] Re: Looping through a DataGrid, in order to get Grand Total from 1 specific Column?
As usual, thanks for the clarification Gordon. :)
-TH
_______________________________
Tim
Hoff
Cynergy Systems,
Inc
http://www.CynergySystems.com
Office:
1.866.CYNERGY
---
In [email protected], "Gordon Smith" <[EMAIL PROTECTED]>
wrote:
>
> A DataGrid only creates enough rows to fill out its
height. For example,
> if you have 1000 items in your dataProvider and the
height of the
> DataGrid only allows you to see 10 of them, then it only
creates 10 rows
> and it "recycles" them with new data as you scroll. This
is how it can
> scroll through a huge data set.
>
>
>
> Therefore, you can't get a "whole column of data" out of a
>
DataGridColumn. The whole data -- all the items -- is only in the
>
dataProvider, and each column simply has info -- such as the
>
labelFunction -- that tells the DataGrid how to display the visible
>
items.
>
>
>
> - Gordon
>
>
>
> ________________________________
>
> From:
[email protected] [mailto:[EMAIL PROTECTED] On
> Behalf
Of Tim Hoff
> Sent: Saturday, October 21, 2006 2:20 PM
> To:
[email protected]
> Subject: [flexcoders] Re: Looping through a
DataGrid, in order to get
> Grand Total from 1 specific Column?
>
>
>
> Mike,
>
> The DataGrid columns object is
an array of DataGridColumn objects. I
> suppose that you could drill-down
to get the DataGridColumn data objects
> for calculation, but using the
dataProvider is the way that I've found
> to be easiest and most
direct.
>
> -TH
> _______________________________
>
> Tim Hoff
> Cynergy Systems, Inc
>
http://www.CynergySystems.com <http://www.cynergysystems.com/>
>
Office: 1.866.CYNERGY
>
>
> --- In
[email protected], "Mike Anderson" mike@ wrote:
> >
>
> Thank You Tim!
> >
> > That would have been my next
step, if I couldn't figure out how to get
> > the Column method to
work.
> >
> > With that said, isn't there still a way to grab
the DataGrid's Column,
> > and then loop through it's values??
>
>
> > For example:
> >
> > var
myColumn:DataGridColumn = myDataGrid.columns(5);
> >
> > Then
perform some looping on this?
> >
> > Or:
> >
> > var myColumn:Object = myDataGrid.columns(5);
> >
>
> Just thinking out loud on this - as I am just trying to figure out
if
> > this can be done, by grabbing a reference to the DataGridColumn
- and
> > then doing my logic. The problem is, I don't know if it's
just the
> > Column reference that gets passed to the Variable, or if
the Data
> comes
> > along with it...
> >
> >
Eith! er way, thanks for the idea - and I appreciate the reply,
> >
> > Mike
> >
> >
________________________________
> >
> > From:
[email protected] [mailto:[EMAIL PROTECTED]
>
On
> > Behalf Of Tim Hoff
> > Sent: Saturday, October 21, 2006
1:29 AM
> > To: [email protected]
> > Subject:
[flexcoders] Re: Looping through a DataGrid, in order to get
> > Grand
Total from 1 specific Column?
> >
> >
> >
>
> Hi Mike,
> >
> > You could use calculations like this on
the dataProvider and bind the
> > return value to the
textField.
> >
> > private function calculateTotal(
myDataProvider : ArrayCollection ) :
> > Number
> > {
>
> var totalAmount : Number = 0;
> >
> > var n:int =
myDataProvider.length;
> > for (var i:int = 0; i < n; i++)
>
> {
> > totalAmount += Number(myDataProvider[i].UnitPrice! *
>
> myDataProvider[i].Quantity);
> > }> > return
totalAmount;
> > }
> >
> > -TH
> >
__________________________________
> >
> > Tim Hoff
>
> Cynergy Systems, Inc.
> > http://www.cynergysystems.com
<http://www.cynergysystems.com/>
> > Office
<http://www.cynergysystems.comoffice/> : 866-CYNERGY
> >
> > --- In [email protected], "Mike Anderson" mike@
wrote:
> > >
> > > Hello All,
> > >
>
> > I've done this before with Flash, but for the life of me, I
can't
> > > remember how I did it...
> > >
> >
> I need to loop though my DataGrid's Rows, and add up each value
>
> > contained in the "Total" Column.
> > >
> > >
And, I can't use my DataProvider property - because "Total" isn't
>
part
> > > of the DataProvider - it's a column added to the DataGrid
after the
> > fact
> > > - and then I am using a
LabelFunction, in order ! to populate the
> Total
> > > Column
(UnitPrice * Quantity).
> > >
> > > My goal, is to
update a TextInput on the bottom of the page, each
> time
> >
a
> > > new entry is made on the Grid (or if a value changes). I
took care
> of
> > > that already - by using the itemEditEnd
event...
> > >
> > > Sorry for the newbie question - I
am having a major mental block
> right
> > > now.
> >
>
> > > Thanks in advance all,
> > >
> >
> Mike
> > >
> >
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Software development tool | Software development | Software development services |
| Home design software | Software development company |
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___

