To summarize, don’t try to access the rendered controls directly.  Instead, have the cell renderer update the dataProvider, then loop over the dataProvider to make your selected array.

 

Tracy

 


From: [email protected] [mailto:[email protected]] On Behalf Of t_msreddy
Sent: Tuesday, March 21, 2006 9:17 AM
To: [email protected]
Subject: [flexcoders] Re: Accessing a custom cellrenderer

 

Look at the code below and try in similar lines in your cellRenderer file:

 

 var rowIndex : Number;
 var columnIndex : Number;
 
 var getCellIndex : Function; // the function we receive from the list
 var getDataLabel : Function; // the function we receive from the list
 
 function setValue( str:String, item:Object, sel:Boolean ) {
  //Dumper.info("@@This cell belongs to:" + str);
  
  if(rowIndex == undefined || columnIndex == undefined)
  {
   rowIndex = getCellIndex().itemIndex;
   columnIndex = getCellIndex().columnIndex;
  }   
  var projectMemberVO : ProjectMemberVO = ProjectMemberVO(item);
  var projectMemberWeekArray : Array = projectMemberVO.projectMemberWeekArray;
  if(!isNaN(Number(projectMemberWeekArray[columnIndex].forecastHours)) && Number(projectMemberWeekArray[columnIndex].forecastHours) != 0)
  {
   //Dumper.info("projectMemberWeekArray[columnIndex].forecastHours setting to weekHoursForecast.text");
   weekHoursForecast.text = projectMemberWeekArray[columnIndex].forecastHours;
  } else
  {
   weekHoursForecast.text = "";
  }
  
  
 }
 
 function updateWeekHoursDataProvider()
 {
  if (!isNaN(weekHoursForecast.text))
  {
   ModelLocator.currentProject.projectTeamVO.projectMembersArray[rowIndex].projectMemberWeekArray[columnIndex].forecastHours = weekHoursForecast.text;
  }
  
 }

 

 

 


--- In [email protected], "digital_eyezed" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a simple cellrenderer in a List which contains a checkbox.
>
> I want to check through the list to see which items are checked.
>
> Here is the cellrenderer:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:HBox styleName="wizardContainer" horizontalAlign="left"
> xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%"
> height="100%">
> <mx:Script>
> <![CDATA[
> var theLabel;
> var theData;
> function setValue(str:String, item:Object, sel:Boolean){
> theLabel = String(item.label);
> theData = Number(item.data);
> }
> ]]>
> </mx:Script>
> <mx:Spacer width="5"/>
> <mx:CheckBox width="20" id="siteSelected" selected="false"/>
> <mx:Text width="100%" text="{theLabel}"
> styleName="cellRendererText"/>
> </mx:HBox>
>
> Here is the list:
>
> <mx:List cellRenderer="components.WizardCell" id="list2"
> width="100%" height="100%"
> dataProvider="{service.getMethod.result}"/>
>
> There is a Submit button below this which when clicked I want to
> check through the list to see which items have been checked. Each
> object in the list has a data and label attribute from the
> dataProvider, ideally I would like to get an array of the data
> attributes of those checked.
>
> Cheers,
>
> Iain
>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to