My understanding of it all is pretty negligible. I found an example similar
to what I wanted to do online, then modified it just a little to make it
work. My problem was I needed the Summary rows to display text
(templateType), but I also needed them to sort based on a different field
(templateTypeID). I couldn't figure out how to tell it to sort on one, but
display the other. My little hack works, but if I could somehow send the
text to the renderer along with the int, or still have it sort on the int
and only send the text I would at least feel like I'm doing it the right way
instead of duct-taping it. 


If it will help here are some relevant code samples.

here's the grid calling the renderer
************************************************************
<mx:AdvancedDataGrid defaultLeafIcon="{null}" folderClosedIcon="{null}"
folderOpenIcon="{null}"
        displayItemsExpanded="true" id="gridTemplates" left="10" right="10"
top="10" bottom="50" click="gridClick();">
        
        <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{acTemplates}">
                        <mx:Grouping>
                                <mx:GroupingField name="templateTypeID">
                                        <mx:SummaryRow summaryPlacement="group">
                        <mx:fields>
                            <mx:SummaryField dataField="templateTypeID"
label="templateTypeID" />
                        </mx:fields>
                    </mx:SummaryRow>
                                </mx:GroupingField>
                        </mx:Grouping>
                </mx:GroupingCollection>
        </mx:dataProvider>
        <mx:columns>
                <mx:AdvancedDataGridColumn dataField="name" headerText="Formal 
Name"
width="280"/>  
                <mx:AdvancedDataGridColumn dataField="abbreviation" 
headerText="Short
Name" width="150"/>
                <mx:AdvancedDataGridColumn dataField="insertDate" 
headerText="Date
Created" width="150"/>
                <mx:AdvancedDataGridColumn dataField="templateID" width="0"
visible="false"/>
        </mx:columns>
        <mx:rendererProviders>
        <mx:AdvancedDataGridRendererProvider dataField="templateTypeID"
                                             columnIndex="0"
                                             columnSpan="0"
                                             depth="1"
                                             renderer="SummaryRenderer"/>
    </mx:rendererProviders>

</mx:AdvancedDataGrid>
************************************************************
and here's what I'm doing in the renderer
************************************************************
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
backgroundColor="#BBBBBB">
    <mx:Label id="rowLabel" textAlign="center" width="100%">
        <mx:Script>
            <![CDATA[
                                                
                override public function set data( value:Object ):void
                {
                    import mx.controls.Alert;
                    super.data = value;
                        var items:Array =
parentApplication.getChildByName("pubData").text.split("|");
                        var obj:Object = new Object();
                        for (var i:String in items){
                                var props:Array = items[i].split(":");
                                obj[props[0]] = props[1];
                        }
                   
                   
//Alert.show(parentApplication.objTemplate_ID["1"].templateType.toString());
                    // set the html text
                    rowLabel.htmlText = "" + obj[data.GroupLabel] + "";
                }
            ]]>
        </mx:Script>
    </mx:Label>
</mx:Canvas>
************************************************************



Tracy Spratt-2 wrote:
> 
> When (in its life cycle) do you need this object in the renderer?  What
> does
> it do?  When is it initialized or updated?
> 
> Do you have a good understanding of itemRenderer recycling?  Typically,
> there are two kinds of data in a renderer.  Static data, which can be
> compiled in, and item data, which comes from the dataProvider item. 
> Dynamic
> data that is not from the item raises questions.
> 
> Tracy Spratt,
> 
> Lariat Services, development services available
> 

-- 
View this message in context: 
http://old.nabble.com/Passing-an-object-to-a-rendererProvider-tp26396466p26412742.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to