try to catch up with change="event"
regards.
Can anyone tell me how I can get my event listener to update the total
when the quantity is changed using the numericStepper inside a datagrid?
Thanks
Sal
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" xmlns="*" creationComplete="calculateTotal()">
[Bindable]
public var total:Number=0;
[Bindable]
public var numProducts:int=0;
[Bindable]
public var myDP:ArrayCollection = new ArrayCollection();
public function calculateTotal():void{
var t:Number = 0;
var n:Number = 0;
for(var i:int = 0; i < myDP.length; i++){
n += myDP[i].qty;
t += myDP[i].price * myDP[i].qty;
}
total = t;
numProducts = n;
}
public function qtyChangeListener():void{
qtyChanger.addEventListener("change", calculateTotal);
}
<mx:DataGrid id="grid" dataProvider="{myDP}" textAlign="center">
<mx:columns>
<mx:DataGridColumn headerText="Product" dataField="name"/>
<mx:DataGridColumn id="qtyChanger" headerText="Qty" dataField="qty"
rendererIsEditor="true" itemRenderer="mx.controls.NumericStepper"
editorDataField="value"/>
<mx:DataGridColumn headerText="Price" dataField="price"/>
</mx:columns>
</mx:DataGrid>
<mx:Text text="{total}"/>
</mx:Application>
--
----------------------------
Igor Costa
www.igorcosta.com __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
![]()
SPONSORED LINKS
Software development tool Software development Software development services Home design software Software development company
Your email settings: Individual Email|Traditional
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
__,_._,___
Reply via email to

