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:xmlCurrGrades..student[i].name,Assesment:"" }
}
// make the ArrayCollection the Dataprovider
gradeGrid.dataProvider = 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:ClassFactory = new ClassFactory(twoBtnPlusTextArea);
// 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
[EMAIL PROTECTED]);
[EMAIL PROTECTED]);
[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.feedBKStatus == 0)
{
feedBkBtn.setStyle("color","green");
}
else
{
feedBkBtn.setStyle("color","blue");
}
txarea.text = value.gradeData;
}
}
======================================================
Thanks
----- Original Message ----
From: Alex Harui <[EMAIL PROTECTED]>
To: [email protected]
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.
<!--
#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;}
-->
____________________________________________________________________________________
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get listings,
and more!
http://tv.yahoo.com/collections/3658