Adobe Flex

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsWeb Design & DevelopmentAdobe Flex

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old February 26th, 2015, 03:59 AM
rmccleave559 rmccleave559 is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Feb 2015
Posts: 1 rmccleave559 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 12 sec
Reputation Power: 0
Apply DataGridColumn label function to only one label

I have a datagrid column object that is written completely in actionscript, I assign to it a label function that changes the format for a date the problem is that it sets all of the labels in the panel, I want to just set one.

Is there a way to control which labels have the function is applied to?

private function buildTargetDataDG(xmlStageDataList:XMLListCollecti on, bgColor:Boolean):void
{

//returns a normal array of objects that specify DataGridColumn properties
var aColumnDef:Array=getColumnDefArray();
var oColumnDef:Object;

//instantiate a new DataGrid
var dgataGrid=new DataGrid;
var dgcataGridColumn;
var aColumnsNew:Array=dg.columns
var iTotalDGWidth:int=0;


//loop over the column definition array
for (var i:int=0; i < aColumnDef.length; i++)
{
oColumnDef=aColumnDef[i];
//instantiate a new DataGridColumn
dgc=new DataGridColumn();
dgc.labelFunction. = convertDateData;
//start setting the properties from the column def array
dgc.dataField=oColumnDef.dataField;
dgc.width=oColumnDef.width;
//add up the column widths
iTotalDGWidth+=dgc.width;
dgc.editable=oColumnDef.editable;
dgc.sortable=oColumnDef.sortable
dgc.visible=oColumnDef.visible;
dgc.wordWrap=oColumnDef.wordWrap;
// datagrid columns text alignment
dgc.setStyle("textAlign", oColumnDef.textAlign);
dgc.resizable=true;

if(dgc.dataField == "PLOT")
{
dgc.rendererIsEditor= oColumnDef.rendererIsEditor;// true;
dgc.itemRenderer=new ClassFactory(CBRenderer);
}

//push the new dataGridColumn onto the array
aColumnsNew.push(dgc);
}

dg.columns=aColumnsNew;
dg.editable = true;

//dg.addEventListener(ListEvent.ITEM_CLICK, dgRowItemClickEvent);
dg.addEventListener(MouseEvent.CLICK, setSelectedData);
//set the dataProvider
if((xmlStageDataList != null)&&(xmlStageDataList.length > 0))
{
dg.dataProvider=xmlStageDataList;
}
else
{
dg.height=20;
dg.enabled= false;
dg.setStyle("backgroundDisabledColor","0xFF0000");
}

// resizing the datagrid size to accomodate 3 rows + header..
dg.height = 92; //
dg.width = iTotalDGWidth;

pnlTarget.addChild(dg);
}

private function convertDateData(item:Object, columnataGridColumn):String
{
var xml:XML = item as XML;

if(xml == null)
{
var temp:String = xml.child("PDATETIME").text();
var day: int = parseInt(temp.substr(0,20));
var month: int = parseInt(temp.substr(3,2))-1;
var year:int = parseInt(temp.substr(6,4));
var hour:int = parseInt(temp.substr(11,2));
var min:int = parseInt(temp.substr(14,2));
var sec:int = parseInt(temp.substr(17,2));
var tempDateate = new Date(year, month, day, hour, min, sec);

var formatterateFormatter = new DateFormatter();
formatter.formatString = "DD-MMM-YY HH:NN:SS";
temp = formatter.format(tempDate);
return temp;
}
else
{
return null;
}

}

Reply With Quote
Reply

Viewing: Tutorialized ForumsWeb Design & DevelopmentAdobe Flex > Apply DataGridColumn label function to only one label


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap