HI!!

Thank you it worked perfectly and now I understand it.

WAYNEL



----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, September 28, 2007 2:15:59 PM
Subject: RE: [flexcoders] DataGrid cell access question









  


    
            



You should have seen a pattern where the data setter stores 
the data object in a backing variable like _data and calls 
invalidatePropertie s.

 

In commitProperties( ), you should see code that pulls 
fields out of the data object and stuffs them into UI widgets much like you did 
in the rest of your data setter.

 

However, the .data item is going to be an entry in the 
collection.  You've built a collection of objects that nust contain name 
and an empty string for assesment.  If it contained the original XML for 
that student, then you could access it from with in the 
renderer.

 

columnCollection. addItem({ Name:xmlCurrGrad es..student[ i].name,Assesmen 
t:"", rawData: xmlCurrGrades. .student[ i] }


You would set dataField to "rawData", but since you are 
getting a complex object, I would just ignore it and rewrite the mapping code 
more like:

 

override protected function 
commitProperties( ):void

{

 if(data.rawData. work[0] [EMAIL PROTECTED] == 0! 
)
                
{
                
    
docBtn.setStyle( "color"," yellow");
    
            }
    
            
else
            
    {
            
        
docBtn.setStyle( "color"," orange");
    
            }
    
            
    
            if(data.rawData. work[0] [EMAIL PROTECTED] == 
0)
            
    {
            
        
feedBkBtn.setStyle( "color"," green");
        
        }
        
        else
    
            {
    
                
feedBkBtn.setStyle( "color"," blue");
        
        }
        
        
        
        txarea.text = data.rawData. work[0] [EMAIL PROTECTED] ;


}




From: [EMAIL PROTECTED] ups.com 
[mailto:flexcoders@ yahoogroups. com] On Behalf Of Wayne 
LaRochelle
Sent: Friday, September 28, 2007 11:12 AM
To: 
[EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] DataGrid cell 
access question









HI!!

I 
have taken a look at many of the itemRenderer examples, but I have not seen 
what 
I am trying to do.

I am building a grading screen. the screen is a 
DataGrid with an unknown number of rows and columns so I am building it 
dynamically.

for this test its just 1 row of 2 
columns

============ ========= ========= ========= ========= ========= ========= =====
for(var 
i:Number = 0; i < numOfStudents; i++)
{
    
        //add data to the 
ArrayCollection
            
columnCollection. addItem({ Name:xmlCurrGrad es..student[ i].name,Assesmen t:"" 
}
}    
      

        // make the ArrayCollection the 
Dataprovider
        
gradeGrid.dataProvi der = 
columnCollection;
        gradeGrid.x = 
350;
        gradeGrid.y = 
100;
        
    
    for (var i:Number = 1; i<gradeGrid.columns. length; 
i++)
        {
    
        // grab the column 
instances
            var 
gradeGridCol: DataGridColumn = 
gradeGrid.columns[ i];
         

            // assign the new 
item renderer
            var 
renderer:ClassFacto ry = new 
ClassFactory( twoBtnPlusTextAr ea);

    
        // assign our custom 
renderer
            
 gradeGridCol. itemRenderer = renderer;
    
             
    
        
}
        // add the dataGrid to the 
screen            
                
        
        
addChild(gradeGrid) ;
============ ========= ========= ========= ========= ========= ========= ======

Each 
DataGrid Cell contain 2 buttons and a Text field. the data from the XML looks 
like this for each 
cell

 xmlCurrGrades. .student[ 0].work[0] [EMAIL PROTECTED]) ;
 xmlCurrGrades. .student[ 0].work[0] [EMAIL PROTECTED]) ;
xmlCurrGrades. .student[ 0].work[0] [EMAIL PROTECTED]) ;

What 
I don't understand is how to get this data into the data property. The 
"dataField" is only a single String.

My override of set data() in the 
itemRenderer looks like 
this

============ ========= ========= ========= ========= ========= ========= =======
override 
public function set data(value:Object) :void
    
    {
            
if(value != null)
            
{
                
super.data = value;

        
        if(value.docStatus == 0! 
)
                
{
                
    
docBtn.setStyle( "color"," yellow");
    
            }
    
            
else
            
    {
            
        
docBtn.setStyle( "color"," orange");
    
            }
    
            
    
            
if(value.feedBKStat us == 0)
        
        {
        
            
feedBkBtn.setStyle( "color"," green");
        
        }
        
        else
    
            {
    
                
feedBkBtn.setStyle( "color"," blue");
        
        }
        
        
        
        txarea.text = 
value.gradeData;
            
}
        
}
============ ========= ========= ========= ========= ======

Thanks













----- 
Original Message ----
From: Alex Harui <[EMAIL PROTECTED] com>
To: 
[EMAIL PROTECTED] ups.com
Sent: Thursday, September 27, 2007 4:40:01 
PM
Subject: RE: [flexcoders] DataGrid cell access question





Every example out there should be doing this.  Look at 
the source for mx.controls. listClasses. TileListItemRend erer.  You can 
also find examples on my blog (blogs.adobe. com/aharui)




From: [EMAIL PROTECTED] ups.com 
[mailto:flexcoders@ yahoogroups. com] On Behalf Of Wayne 
LaRochelle
Sent: Thursday, September 27, 2007 3:05 PM
To: 
[EMAIL PROTECTED] ups.com
Subject: Re: [flexcoders] DataGrid cell 
access question









HI!!

thanks 
for responding.

I'm confused about the use of the data property can you 
aim me in a direction of an example???

Thanks







----- 
Original Message ----
From: Alex Harui <[EMAIL PROTECTED] com>
To: 
[EMAIL PROTECTED] ups.com
Sent: Thursday, September 27, 2007 12:55:12 
PM
Subject: RE: [flexcoders] DataGrid cell access question





renderers are data driven.  The .data property should 
hold the items from the XML file and you should set the buttons and textArea 
based on what you find in the .data property.




From: [EMAIL PROTECTED] ups.com 
[mailto:flexcoders@ yahoogroups. com] On Behalf Of 
waynelll
Sent: Thursday, September 27, 2007 11:42 AM
To: 
[EMAIL PROTECTED] ups.com
Subject: [flexcoders] DataGrid cell access 
question






HI!!

I have a question about using a DataGrid with a custom 
itemRender. 

Each of my DataGrid Cells contains an HBox within which are 
2 buttons
and a text field. I realize that there are performance issues 
with
this design but these are my current specs.

The problem I am 
having is how to initialize the two buttons and the
text area at startup. 
Each button can be in one of four states and the
text area can contain any 
number between 1 and 100, the info comes out
of a XML file which I read in at 
startup.

I have been unsuccessful in trying to walk through the DataGrid 
using 
getChildAt to gain access to the Cell and Buttons.

I'm looking 
for any ideas. 


WAYNELLL











Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. 










Tonight's top picks. What will you watch tonight? Preview 
the hottest shows on Yahoo! TV. 




    
  

    
    




<!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#0000ff;text-decoration:none;}
-->



<!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
-->



<!--

#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, 
sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}

#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{
padding:0;margin:2px 0;}
#ygrp-vital ul li{
list-style-type:none;clear:both;border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
#ygrp-vital ul li .cat{
font-weight:bold;}
#ygrp-vital a{
text-decoration:none;}

#ygrp-vital a:hover{
text-decoration:underline;}

#ygrp-sponsor #hd{
color:#999;font-size:77%;}
#ygrp-sponsor #ov{
padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;margin:0;}
#ygrp-sponsor #ov li{
list-style-type:square;padding:6px 0;font-size:77%;}
#ygrp-sponsor #ov li a{
text-decoration:none;font-size:130%;}
#ygrp-sponsor #nc{
background-color:#eee;margin-bottom:20px;padding:0 8px;}
#ygrp-sponsor .ad{
padding:8px 0;}
#ygrp-sponsor .ad #hd1{
font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
#ygrp-sponsor .ad a{
text-decoration:none;}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;}
#ygrp-sponsor .ad p{
margin:0;}
o{font-size:0;}
.MsoNormal{
margin:0 0 0 0;}
#ygrp-text tt{
font-size:120%;}
blockquote{margin:0 0 0 4px;}
.replbq{margin:4;}
-->








       
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

Reply via email to