Solved

dynamic LabelFunction for daynamically created datagrid column

Posted on 2010-11-22
4
855 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
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.

735 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