Solved

dynamic LabelFunction for daynamically created datagrid column

Posted on 2010-11-22
4
857 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to how to record live broadcast.

726 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