Solved

dynamic LabelFunction for daynamically created datagrid column

Posted on 2010-11-22
4
853 Views
Last Modified: 2012-05-10
Iam creating a datagrid column dynamically  like this.
for (ii = 1; ii<=nbOfpps; ii++){
      nwColumn= new DataGridColumn(ii.toString());
                                          nwColumn.dataField = "corr" + ii.toString()
                                          nwColumn.width=50;
                                          nwColumn.labelFunction  
                                          nwColumnsArray.push(newColumn);
}
I want to set the format of this column to 6 decimal places. Can u some one say how? Remember the column name is formed by ii.toString()
0
Comment
Question by:randyraj
  • 3
4 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 34195768
Give this a try:

nwColumn.labelFunction = "formatFunc";

<mx:NumberFormatter id="numberFormatter" precision="6"
        useThousandsSeparator="true" useNegativeSign="true"/>

private function formatFunc( item:Object, column:DataGridColumn):String {
       return numberFormatter.format(item[column.dataField]);
}
0
 
LVL 37

Accepted Solution

by:
zzynx earned 500 total points
ID: 34195776
or maybe assigning the labelFunction is without "":

nwColumn.labelFunction = formatFunc;
0
 

Author Closing Comment

by:randyraj
ID: 34312731
Thanks
0
 
LVL 37

Expert Comment

by:zzynx
ID: 34316832
Thanx 4 axxepting
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now