Try this:
private function printDG():void{
var strToPrint:String = new String();
for(var n:Number=0;n<dg.columnCount;n++){
strToPrint += dg.columns[n].dataField + "\t";
}
strToPrint += "\n";
for each(var item:Object in dg.dataProvider){
for(var i:Number=0;i<dg.columnCount;i++){
strToPrint += item[(dg.columns[i].dataField)] +
"\t";
}
strToPrint += "\n";
}
trace(strToPrint);
}
Debug and check the value of strToPrint and let me know if this is the
same thing you are looking for.
HTH,
-Ravi
On Apr 27, 8:51 am, Akhil Agrawal <[email protected]> wrote:
> plz help me in this regard...........
>
> On Apr 24, 6:26 pm, Akhil Agrawal <[email protected]> wrote:
>
> > ie here i tried to store the field name in the variable str and then
> > tried to get value bt it is not working how it is possible to get
> > value
> > by a variable
> > thanx
> > akhil agrawal
>
> > On Apr 24, 6:14 pm, Akhil Agrawal <[email protected]> wrote:
>
> > > Hi all,
> > > i am trying to print the value of field of an arraycollection. suppose
> > > i do't know the field name. i m trying like this
>
> > > [Bindable]
> > > public var expenses:ArrayCollection= new ArrayCollection([
> > > {Month:"Jandfadfadfdafdaf", Profit:2000, Expenses:1500, Amount:
> > > 450},
> > > {Month:"Fedafdafdfdfb", Profit:1000, Expenses:200, Amount:
> > > 600},
> > > {Month:"Mafadfrgrgrerewfrerewtreftrefr", Profit:1500, Expenses:
> > > 500, Amount:300}]
> > > )
>
> > > public function ff():void{
> > > var dg:DataGrid=new DataGrid();
> > > dg.verticalScrollPolicy="false";
> > > dg.variableRowHeight=true;
> > > dg.variableRowHeight=true;
> > > dg.height=c1.height;
> > > dg.wordWrap=true;
> > > dg.dataProvider=expenses;
> > > var he:DataGridColumn=dg.columns[0];
> > > var str:Object=he.headerText;
> > > Alert.show(he.headerText,"djf");
> > > Alert.show(expenses.getItemAt(0).,"fdfjdf");
> > > dg.width=c1.width;
> > > c1.addChild(dg);
> > > dg.columns[0].width=dg.width*.50;
> > > Alert.show(dg.rowHeight.toString(),"");
> > > }
>
> > > suppose i do't know the fields of arraycollection ie. do not know that
> > > fieldname are month,amout etc. bt want the information as string for
> > > the field how it is possible
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---