Solved

dynamic LabelFunction for daynamically created datagrid column

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

762 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

16 Experts available now in Live!

Get 1:1 Help Now