Re: [flexcoders] getting the sum of values in list datafield.

2014-08-29 Thread Scott Fanetti [email protected] [flexcoders]
IMHO - you should create a separate bindable string and set the value to that 
instead of directly setting the .text property of a text field.  Your reduce 
function seems ok - just run each object through the filter function to see if 
it returns true. Only objects that return true should be added to the sum. 

You are 99% of the way there.  What is tripping you up? 

Sent from my iPhone

> On Aug 29, 2014, at 4:55 AM, "[email protected] [flexcoders]" 
>  wrote:
> 
> Hello, i have a flex list that is populated by an arraycollection. in the 
> arraycollection i have a field subTotal and i would like to calculate the 
> subtotals from that field and pin them to a text component and i would like 
> to do that even when the list is filtered. below is my code
> 
> 
> http://www.adobe.com/2006/mxml";
> layout="vertical"
> width="100%"
> height="100%"
> verticalAlign="top"
> verticalGap="0"
> paddingTop="0"
> paddingBottom="0"
> paddingLeft="0"
> paddingRight="0"
> xmlns:ns1="ascript.*"
> creationComplete="init()"
> initialize="initDate()"
> xmlns:ns2="components.*">
> 
> 
> 
> 
> 
> 
> 
>   destination="ColdFusion"
>  source="moRentals.src.CFCs.crud"
>  showBusyCursor="true"
>  
> fault="CursorManager.removeBusyCursor();Alert.show(event.fault.message)">
> 
> result="expenseResult(event)"/>
> 
> 
> 
>precision="0"
>   thousandsSeparatorTo=","
>   useThousandsSeparator="true"
>   rounding="up"
>   currencySymbol="UGX "/>
> 
>formatString=" DD, "/>
> 
>   width="100%"
>  height="50"
>  verticalAlign="middle"
>  verticalGap="0">
> 
> 
> 
> 
> 
> 
>   height="100%"
>  horizontalGap="0">
>   height="100%"
>  verticalGap="0"
>  backgroundColor="#818284"
>  horizontalAlign="center">
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   backgroundColor="#FF"
>  verticalGap="0">
> 
> 
>   paddingLeft="40"
>  paddingRight="45"
>  verticalAlign="middle"
>  height="66">
> 
>styleName="listLabel"/>
>change="expenseAr.refresh();"/>
>styleName="listLabel"/>
>change="expenseAr.refresh();"/>
> 
> click="createdaddPopup()"/>
> 
> 
> 
> 
> 
> 
>   paddingLeft="40"
>  paddingRight="46"
>  verticalAlign="middle"
>  height="36">
> 
>width="120"
>   styleName="listLabelHeading"/>
>width="90"
>   styleName="listLabelHeading"/>
>width="130"
>   styleName="listLabelHeading"/>
>width="90"
>   styleName="listLabelHeading"/>
>width="90"
>   styleName="listLabelHeading"/>
>width="90"
>   styleName="listLabelHeading"/>
> 
> 
> 
> 
> 
>   width="100%"
>  dataProvider="{expenseAr}"
>  itemRenderer="renderers.expenseListRenderer"
>  selectedIndex="0"
>  height="100%"
>  paddingBottom="0"
>  borderSkin="{null}"/>
>   backgroundColor="#0F76BB"
>  height="35"
>  verticalAlign="middle"
>  paddingLeft="20"
>  paddingRight="20">
> 
> 
> 
> 
>  

Re: [flexcoders] getting the sum of values in list datafield.

2014-08-29 Thread Alex Harui [email protected] [flexcoders]
The code looks mostly ok.  I noticed you commented out the addEventListener 
calls for COLLECTION_CHANGE.  I'll bet it threw an error becuae expenseAr is 
null until the RemoteObject returns a result.  I would move the 
addEventLIstener call to expenseResult() method when you know expenseAr is 
valid.


-Alex

From: "[email protected] [flexcoders]" 
mailto:[email protected]>>
Reply-To: "[email protected]" 
mailto:[email protected]>>
Date: Friday, August 29, 2014 1:55 AM
To: "[email protected]" 
mailto:[email protected]>>
Subject: [flexcoders] getting the sum of values in list datafield.



Hello, i have a flex list that is populated by an arraycollection. in the 
arraycollection i have a field subTotal and i would like to calculate the 
subtotals from that field and pin them to a text component and i would like to 
do that even when the list is filtered. below is my code


http://www.adobe.com/2006/mxml";
layout="vertical"
width="100%"
height="100%"
verticalAlign="top"
verticalGap="0"
&n! bsp;   paddingTop="0"
paddingBottom="0"
paddingLeft="0"
paddingRight="0"
xmlns:ns1="ascript.*"
creationComplete="init()"
initialize="initDate()"
xmlns:ns2="components.*">




&nbs! p;   














  !   
 &nbs! p;  















  &n! bsp; 












&nbs! p;





&! nbsp;   










  ! ;  






 &nb! sp;  


 ! ;   










 &n! bsp;  



 &! nbsp;&nb sp; 









&nbs! p;






 ! ;