Thanks Prakash for the quick reply ,
but i want to add data dynamically , no hardcoding can be done ....
i am reading a text file from a server , formating it , taking the
headers , and passing them to the columns .
here in the below code the result strarr is an array resultstrarr =
recordstring.split("\\011");
will have data , and i have put that in a loop so that for each record
the splitting is done and placed in this array .
this data shuld get populated in their respective columns ...
is there any way to populate it without hardcoding the values :)
once again thanks for the quick reply
On Feb 25, 5:01 pm, GnanaPrakasam T <[email protected]> wrote:
> Hi Swathi
>
> For his you have to define the datafield also when creating new column,
> For this if you have change your columnData Array as Arraycollection and add
> datas with the labels what you have specifies as datafield for coloumn
>
> private function addDataGridColumn(dataField:String):void {
> var dgc:DataGridColumn = new DataGridColumn(dataField);
> * dgc.dataField="total"; *
> var cols:Array =myGrid.columns;
>
> cols.push(dgc);
> myGrid.columns =cols;
> }
>
> for(var i=1 ; i<rec_arr.length;i++)
> {
> recordstring = rec_arr[i].toString().replace(/"/g,"");
> //Alert.show(recordstring +"");
> resultstrarr = recordstring.split("\\011"); /// here are
> mydata
>
> //Alert.show(resultstrarr.length +"");
> *columnData.additem(new Object(total:resultstrarr[3]));*
> }
>
> *Gnanz.../http://gnanz-flexworld.blogspot.com*
>
>
>
> swathi wrote:
> > Hello All,
>
> > I am hanging near a piece of code , want some suggestions :(
>
> > I created a data grid using flex2.0 , added columns to it dynamically
> > by passing the header text as the parameter
> > to the following function.
>
> > private function addDataGridColumn(dataField:String):void {
> > var dgc:DataGridColumn = new DataGridColumn
> > (dataField);
> > var cols:Array =
> > myGrid.columns;
> > cols.push(dgc);
> > myGrid.columns =
> > cols;
> > }
>
> > columns are built ; but the problem is i have to populate the data
> > into these columns .
> > i have my data in an array : find the code below
>
> > for(var i=1 ; i<rec_arr.length;i++)
> > {
> > recordstring = rec_arr[i].toString().replace(/"/g,"");
> > //Alert.show(recordstring +"");
> > resultstrarr = recordstring.split("\\011"); /// here are my
> > data
>
> > //Alert.show(resultstrarr.length +"");
> > columnData.push(resultstrarr[3]);
> > }
>
> > i want this data to get displayed in the columns created .....
>
> > suggestions please and it is bit urgent.
>
> > thanks ...- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---