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
Solved

dynamic LabelFunction for daynamically created datagrid column

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

829 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