are you getting a total or not?
just do return total.toString();

----- Original Message ----
From: Harry Saputra <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, February 5, 2008 9:17:36 AM
Subject: [flexcoders] Null Return when try to get total of sum from one field

I try this :

.mxml file :

...
<mx:DataGridColumn id="sks" headerText=" SKS" width="20" dataField="sks" />
...
<mx:Button x="685" y="10" label="Button" click="showTotalDat aTranskrip( )"/>
...

.as file :

[Bindable]
Public var lengthArrDataTranks rip:int;
public var total:Number;

public function totalDataTranskrip( col:DataGridColu mn):String
{

lengthArrDataTranks rip = arrDataTranskrip. length; //
arrDataTranskrip is DataProvider as Array

for (var i:int = 0; i < lengthArrDataTranks rip; i++)
{ 
total = total + Number(arrDataTrans krip[i][col. dataField] );
}

return String(total) ;

}

public function showTotalDataTransk rip():void
{
txtTotalSKS. text = totalDataTranskrip( sks);
}

I get Null Return...please help me to solve this problem, thanks :)





      
____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Reply via email to