this the complete sample code for the work i want to do i have data as string from that i have to identify column and then display corresponding data in a grid
<?xml version="1.0"?> <!-- dpcontrols/DataGridPassData.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="initData()"> <mx:Script> <![CDATA[ import mx.collections.*; import mx.controls.Alert; import mx.collections.ArrayCollection; import mx.controls.DataGrid; import mx.controls.dataGridClasses.DataGridColumn; //data to be display in grid private var str:String="{'Artist Name':'Pavement', 'Album':'Slanted and Enchanted', 'Price':'11.99'}*{'Artist Name':'Pavement', 'Album':'Brighten the Corners', 'Price':'11.99'}"; // Alert.show(str,"string"); private var DGArray:Array =str.split("*"); // Alert.show(DGArray[0].toString(),"array"); [Bindable] public var initDG:ArrayCollection; //Initialize initDG ArrayCollection variable from the Array. //You can use this technique to convert an HTTPService, //WebService, or RemoteObject result to ArrayCollection. public function initData():void { initDG=new ArrayCollection(DGArray); var dcolumn:DataGridColumn=new DataGridColumn(); Alert.show(DGArray[0].toString(),"dg"); var row:Array=DGArray[0].toString().split(","); Alert.show(row.length.toString()+row[0].toString(),"row"); var colName:String; var gridcolumns:Array=new Array(); for(var i:int=0;i<row.length;i++) { colName=row[i].toString().substr(1,row[i].toString().indexOf (":")-1); colName=colName.substring(1,colName.length-1); Alert.show(colName,"col name"); dcolumn=new DataGridColumn(); dcolumn.dataField=colName; // Alert.show(dcolumn.dataField.toString(),"field"); dcolumn.resizable=true; dcolumn.minWidth=200; gridcolumns.push(dcolumn); } myGrid.columns=gridcolumns; myGrid.dataProvider=initDG; } ]]> </mx:Script> <mx:DataGrid id="myGrid" width="350" height="200"> </mx:DataGrid> </mx:Application> for this i am trying to parse the string to idengtify column . It idefying the columns perfectly and displayin column name in grid bt display complete string {'Artist Name':'Pavement', 'Album':'Slanted and Enchanted', 'Price':'11.99'} in each column Now plz help me to do this thank Regards Akhil Agrawal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

