ItemRenderer problem

I have this simple inline ItemRenderer that is supposed to
get a value from a function. However, the function return value
does not get displayed... whereas localVar does. Any ideas?
<mx:DataGridColumn headerText="Checklist Completeness"
headerWordWrap="true" width="570" >
<mx:itemRenderer >
<mx:Component>
<mx:VBox width="100%" height="50"
horizontalAlign="center" verticalAlign="middle">
<mx:Label text="{outerDocument.localVar}" />
<mx:Label text="{outerDocument.localFunc()}" />
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

I was hoping to generate URL's on the fly and use for
fetching images from my database. I will try sending a parameter
in, that is what i need to do anyway. The function will return a
URL with parameters appended:
?imageId=ABC99383&width=100&height=100. ABC99383 will come
from dataprovider of Datagrid.
Lots of pot holes to go around in Flex, or is it my
inexperience?

Similar Messages

  • Dynamic datagrid rowHeight and itemRenderer problem

    Hi guys,
    Long time listener; first time caller....
    I have had a look around the forums here and i can see there are a lot of similar issues to the one i'm currently having but not so many solutions. Not sure if i'll have any better luck with my question but here goes...
    My issue is to do with the row height of a datagrid row not matching up properly with the height of the custom iterm renderer used on a column.
    The item renderer consists of an HBox containing an image and a textArea. The image will not always be present and the text area can contain a couple of words or many lines of text.
    I have overridden the measure function of the item render in which i am manually setting the HBox's height and measuredHeight.
    Problem is that i have to find some way of triggering a redraw of the datagrid AFTER if have set the item renderers height, but i dont seem to be able to directly access the in-line renderer from the parent class.
    If anyone could throw any suggestions my way it would be greatly appreciated!
    thanks '
    Dave

    Ok so here's the sample code...
    ****Renderer*****
    <?xml version="1.0" encoding="utf-8"?>
    <mx:HBox 
    horizontalAlign="
    left" verticalAlign="
    middle" horizontalGap="
    0"verticalGap="
    0"xmlns:mx="
    http://www.adobe.com/2006/mxml" horizontalScrollPolicy="
    off"verticalScrollPolicy="
    off"width="
    100%" height="
    100%"resize="measure()"
    borderColor="
    green"borderStyle="
    solid" 
    >
    <mx:Metadata>[
    Event(name="gridRowHeightChange", type="flash.events.Event")] 
    </mx:Metadata>
    <mx:Script>
    <![CDATA[
    import mx.events.ResizeEvent;
    import flash.events.Event;
    Bindable] public var showLocalPartImage:Boolean = false; 
    override public function set data(value:Object):void
         super.data = value; 
         lblPartNum.text = data.label;}
    override protected function measure():void
         super.measure(); 
         if(lblPartNum.text != "" && lblPartNum.width > 0)     {
              lblPartNum.validateNow();          lblPartNum.mx_internal::getTextField().autoSize = TextFieldAutoSize.LEFT;
              lblPartNum.height =
              this.height = measuredHeight = lblPartNum.mx_internal::getTextField().height; 
              dispatchEvent(
    new Event("gridRowHeightChange"));     }
    ]]>
    </mx:Script>
    <mx:Image id="imgLocal" horizontalAlign="center" verticalAlign="middle" visible="false" width="{0}"/> 
    <mx:TextArea id="lblPartNum" width="{this.width - imgLocal.width - 4}" height="100%" editable="false" verticalScrollPolicy="off" />
    </mx:HBox>
    ****EndRenderer*****
    ****DataGrid****
     public function measureGrid(event:Event):void{
    shoppingCart.removeEventListener(DataGridEvent.COLUMN_STRETCH, measureGrid);
    shoppingCart.invalidateList();
    shoppingCart.addEventListener(DataGridEvent.COLUMN_STRETCH, measureGrid);
     <mx:DataGrid id="shoppingCart"width="
    100%" height="100%"dataProvider="
    {_order.orderItems}"allowMultipleSelection="
    true"sortableColumns="
    true"variableRowHeight="
    true"doubleClickEnabled="
    true"doubleClick="selectPartHandler(event)"
    paddingRight="
    5"editable="
    false" 
    >
     <mx:columns>
     <mx:DataGridColumn width="22" minWidth="20" sortable="false" editable="false"/>
     <mx:DataGridColumn width="22" minWidth="20" sortable="false" editable="false"/>
     <mx:DataGridColumn minWidth="240" width="270" dataTipField="description" dataField="description" headerText="Description"editable="
    false" wordWrap="true">
     <mx:itemRenderer>
     <mx:Component>
     <controls:DescriptionShoppingCartRenderer showLocalPartImage="
    {!(outerDocument.displayUnderline)}" gridRowHeightChange="{outerDocument.measureGrid(event)}">
     </controls:DescriptionShoppingCartRenderer>  
    </mx:Component>
     </mx:itemRenderer>
     </mx:DataGridColumn>
    ****EndDataGrid****
    Unfortunately the whole code is much too large to fit in here, but here are the main working parts.
    I hope this helps.
    What i am getting when running this is strange. When i run the first time and when i resize a column, the row height is incorrect, but then when i just click the 'column stretch' arrow (ie the space between the column headers) and dont actually resize at all, the row heights re-calculate and they fit perfectly.
    This makes me think that i need to trigger this event manually AFTER the itemRenderer has been calculated.
    EDIT: forgot to add the measureGrid function

  • Custom ItemRenderer Problem

    Hello,
    I have a requirement to display an image in some rows in the
    datagrid based on a flag obtained from the database. To achieve
    this, I am using a custom itemrenderer for that particular column
    and on a simple check if the value obtained for that particular row
    is 1 then I show the image, else I leave it blank (i.e set the
    image visibility to false).
    Here is a snippet of the code:
    Custom ItemRenderer
    <mx:HBox .... creationComplete="init();">
    <mx:Script>
    <![CDATA[
    public function init( ):void {
    // Check if the flag is 0 or 1 to determine whether to show
    or hide the image
    if(data.@FLAG == 0) {
    img.visible = false;
    ]]>
    </mx:Script>
    <mx:Image id="img" source="something.gif" />
    </mx:HBox>
    Main Application
    <mx:Application .........>
    <mx:DataGrid dataProvider="{myXML.item}" ... >
    <mx:columns>
    <mx:DataGridColumn dataField="@FLAG" headerText="Image"
    itemRenderer="CustomItemRenderer" />
    ......... // Other columns
    </mx:columns>
    <mx:DataGrid>
    </mx:Application>
    This code seems to work to a certain level. However, here are
    some problems that i'm facing and would like to know if this is the
    right approach:
    1. The check to determine whether to show the image doesn't
    function well. It shows the image when the flag is 0 and sometimes
    doesn't show the image when the flag is 1.
    2. Upon scrolling or sorting of the datagrid the results of
    the column randomly get messed up losing the images for the ones it
    had before scrolling or sorting and sometimes placing the image in
    another row it does not belong to.
    Can anyone please guide me if they have worked on a similar
    requirement and how it can be achieved. My feeling is that I am
    performing the check in the wrong method. I tried doing it by
    overriding the set data method but that has the scroll problem and
    eventually makes all the images visible initially disappear after
    scrolling or sorting.
    Any help will be much appreciated.
    Thank you.

    Override the set data property and move the code written in
    init() method there:
    override public function set data(value:Object):void {
    super.data = value;
    // Check if the flag is 0 or 1 to determine whether to show
    or hide the image
    if(data.@FLAG == 0) {
    img.visible = false;
    once it works, and there is no reason why it shouldn't, read
    up more on life cycle of renderers in the docs.
    ATTA

  • TileList bulk image display / custom itemRenderer problem

    I create a tilelist with a custom itemRenderer which will display image loaded with some text description, the source is from XML.
    the image displayed correctly from 1 - 10 itemrenderer.
    The problem happens on the itemrenderer 10+, the image is mismatch with the text description.
    The worse thing is when I scroll the tilelist, the image change row by row that does not match with the text.
    Why ? Any solution for this

    Dear Alex
    Many thanks for your hint. It did solve the problem
    My orginal code make a dirty flag at commitProperties() that image load only once at first time. After your hint, I remove the loading code out and the problem has been solved. Thanks
    However performance wise, the image blind and reload whenever I scoll the tilelist, how can I
    a/ make the scrolling process more smoothly
    b/ the image still in the screen ( no blind and off ) whenever I scroll the tilelist
    Thanks and hope to hear your hint again

  • Datagrid combobox as itemrenderer problem.

    Hi All,
         I have different problem. i have a datagrid with10-20 rows. Different item renderers in all columns(6 - 10 columns). In that a single column has combobox as item rederer.
         I have to serve different dataprovider for each row's combobox. I assigned dataprovider by overriding data property. is this right?.
         while my datagrid has scrollbar frequently my rows are refreshing. This makes bad my app.
         Please help me.

    Yes, what you are doing is right, if you think that once the data provider is set on the combobox, and it does not change(except the selected value) then do not assign the data provider from override.
    I would create a dirty flag in the combo itemrend and set this to true once the dataprovider is set on the combo, and will not set the dp again when the override data is called by looking at this dirty flag.

  • Access itemrenderer problem

    I have group container that have itemrenderer  ,I use Array of valueobject to pass date to itemrenderers . days.dataprovider =daysDisplay , days is the group container  and daysDisplay is  an arry of value object. I can access  indexes of  DaysDispaly but I can't access to itemrenderer instance which is deigned to show each of the above value object  :
    Definition of datagroup
    <s:DataGroup x="7" y="54" width="158" height="134"
    id="days_g" itemRenderer="DateChooser.components.DayIcon" rollOverColor="#B6E3FF">
         <s:layout>
              <s:TileLayout horizontalGap="0" verticalGap="0" requestedColumnCount="7"/>
         </s:layout>
    </s:DataGroup>
    Setting dataprovider for datagroup:
    ays_g.dataProvider=daysToDisplay; // daysToDisplay is an ArrayList  contains my valueObjects
    Registerig click event for datagroup:
    days_g.addEventListener(MouseEvent.CLICK,onDaysClick);
    Event handler:
    private function onDaysClick(evt:MouseEvent):void{
                        //here I tried  to access the select method of clicked item renderer
    thank you for your attention.

    I'm not sure what your question is, but you shouldn't access the item renderer directly, but rather modify the data and have your item renderer react to those changes.  See this thread: http://forums.adobe.com/message/3432625#3432625
    If that isn't what you are looking for can you please be more specific in your question?

  • Drag-n-Drop problem in DataGrid with custom ItemRenderer

    Hi,
    I am trying to use a DataGrid to set the ordering of a group
    of images.
    I want to do this with a DataGrid which will show me some
    properties of
    the images in different columns including a thumbnail of the
    image. The
    problem is when I use any custom renderer for any column, the
    draging is
    not working. It works fine when I don't use any ItemRenderer.
    My code looks something like this:
    <mx:DataGrid dragEnabled= "true" dropEnabled= "true"
    dragMoveEnabled= "true">
    <mx:columns>
    <mx:DataGridColumn headerText="Thumb" itemRenderer=
    "component. GridImageRenderer"/>
    <mx:DataGridColumn headerText="Current name" width="100"
    itemRenderer= "component. NameRenderer" />
    <mx:DataGridColumn headerText="New name" width="150"
    dataField="nameNew" />
    </mx:columns>
    </mx:DataGrid>
    Can anyone please give me any clue how to fix this?
    Regards,
    ~ Arif

    Hello again, BinaryDigit.
    I thought we need to apply Drag n drop API for this case.
    Without wasting too much time,
    I tried out as your source code from the previous reply,,,
    Instead of getting it clearly, I got another Confusion... (pardon me)
    Let me clarify this with the examples given,
    I try to adopt previous source code
    and it was this detail;
    1) Taking the X and Y coordinate (from the mouseEvent) Plus jLabel1 coordinate (both X and Y).
    2) Positioning a Coordinate taken to JLabel1
    3) Passing the Coordinate taken to jLabelX, and jLabelY.
    The problem found was;
    if we make 3rd become comments, now the jLabel1
    could works!
    I mean, jLabel1 could be dragged to another Coordinate (by dragging it to another location)
    But,
    if we un-comments the 3rd source code,
    The effect would be no movement of the jLabel1.
    BinaryDigit, is this related to the layout you mentioned before?
    Correct, DarrylBurke! :D
    I thought also the same thing,
    but setLocation() give me another Confusion....
    the coordinate seems taking its basement as a reference.
    I mean, the jLabel Coordinate's is referenced
    from the panel where the jLabel is attached to,
    rather than the Coordinate's of the base jFrame (main base -what should I call this?)
    Sorry, the Details number three (3) is my preference, Since I wanted to see the X, Y movements also.

  • ItemRenderer and DataGrid Problem

    Hi guys.
    I'm on creating a small app that simply pulls information
    from an XML file, displays it in a DataGrid then allows the user to
    filter and search it. First things first though; I'll explain what
    I have so far then detail my problem.
    I get the XML file via HTTPService then place the results in
    a Bindable ArrayCollection. When the Datagrid's source is set to
    that ArrayCollection it works fine. What I am initially trying to
    do is use an itemRenderer in one of the columns that displays lines
    of text depending on the values of the current row.
    For example, the structure of my XML file is (roughly):
    <content>
    <name>Name1</name>
    <description>Description Goes Here</description>
    <audience1>yes</audience1>
    <audience2>no</audience2>
    <audience3>yes</audience3>
    </content>
    So what I am trying to do is group the audiences that each
    piece of "content" has a yes value to. So under the "Audiences"
    column in the datagrid, the above content would say
    "Audience1
    Audience3"
    as it has a yes value in between audience 1 and 3. I've tried
    writing very basic code within the itemRenderer whereby I override
    the public function set data and do some checks there but it never
    seems to work right. I've tried using Arrays within that to store
    the current audiences but I clearly haven't got the right format
    for that.
    There must be a more efficient way of doing this. I'm fairly
    new to both Flex and AS3 (been using AS2 quite a while now) but I
    have a feeling there would be some way to store each row's audience
    list in an array/object/model so I can refer to it later (I'm
    intending to filter these results by audience type later so I think
    I will HAVE to do it this way eventually). I've read quite a few
    tutorials and guides but I honestly don't know where to look
    anymore, none of them seem to cover this specific problem.
    I hope this makes sense to you guys and any guidance you
    could give me would be greatly appreciated.
    Cheers

    LabelFunction produces a display-only column.
    To filter, you will need to use the underlying data.
    Another solution to consider is to create a custom item
    class. Loop over the xmllist and build instances of the class,
    populating the properties from the xml.
    have a property who's value is calculated based on the
    audience properties values. Since it is a "real" data property in
    each item, you can filter on it directly.
    Tracy

  • Problem with Datagrid itemrenderer with a Datagrid

    Hi all,
    I have this kind of a structure. I try to use a datagrid item renderer in a data grid column. However when I try to move rows inside the same datagrid I experience a problem. When my datagrid loads first it seems correct, but when I drag and drop a row in the same datagrid inner datagrids start to be drew in wrong rows. I checked the DB but there are no mistakes in DB records. Problem is with rendering. I suppose inner datagrids trying to draw to early or datagrid component is trying to reuse the itemrenderer. I could not find any solutions for that. Any help will be greatly appreciated..
    <mx:DataGridColumn width="130" editable="false"
              headerText="{resourceManager.getString('resources', 'acl.content')}">
              <mx:itemRenderer>
                   <mx:Component>
                        <ACLInnerDataGrid rowCount="3"     dragEnabled="true"     dropEnabled="false"
                        x="0" y="0"     editable="true" dragInitiatorId="catGrid"
                        filterGroupName="content" remoteDestination="zend"
                        remoteSource="ACLFilterParamService" showHeaders="false"
                        creationComplete="this.init();">
                             <columns>
                                  <mx:DataGridColumn dataField="id" editable="false" visible="false"/>
                                  <mx:DataGridColumn dataField="ruleId" editable="false" visible="false"/>
                                  <mx:DataGridColumn dataField="filterKey" editable="false" visible="false"/>
                                  <mx:DataGridColumn dataField="param" editable="false" visible="false"/>
                                  <mx:DataGridColumn dataField="name" editable="true"/>
                             </columns>     
                        </ACLInnerDataGrid>
                   </mx:Component>
              </mx:itemRenderer>
    </mx:DataGridColumn>
    Thanks in advance.

    I have attached the item renderer component source code.

  • DataGrid itemRenderer column problem

    I have searched high and low and have not found a solution so I'm hoping someone here can help me out.
    When I start up my application, my datagrid (one of the columns uses a itemrenderer) that column, displays everything but it spills / shows funky, then when I scroll some of them get fixed. I don't know exactly what causes this or how to fix it. The column I'm talking about is the "Like" column.
    If code is needed I will provide a pastebin link when requested, and I have attatched a screenshot of what the problem is.
    Any help / suggestions would be appreciated

    Upgrade to 3.4.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Problem with Itemrenderer & Transition in mobile project

    Hallo,
    i made an itemrenderer to display my stuff properly in a list. when the user selects a listitem a transition is played. the problem is, when the user scrolls the list the transition for the selected item is played again.
    i seems to me, that the state of the selected item is changed when the user scrolls. it jumps to normal and goes instantly back to selected and this starts my transition again.
    <s:states>
    <s:State name="normal" />
    <s:State name="selected" />
    </s:states>
    <s:transitions>
    <s:Transition fromState="normal" toState="selected">
    <s:Sequence duration="800" >
    <s:Parallel>
    <s:Resize target="{this}" />
    <s:Fade startDelay="500" target="{test2}" />         
    <s:Fade startDelay="500" target="{test3}" />              
    <s:Fade startDelay="500" target="{test4}" />              
    <s:Fade startDelay="500" target="{test5}" />              
    <s:Fade startDelay="500" target="{test6}" />
    </s:Parallel>
    </s:Sequence>
    </s:Transition>
    </s:transitions>
    This only occours when i scroll the list via touch on the device or via mouse-drag in the emulator. if i use the mousewheel to scroll in the emulator everything is fine. So am i doing something wrong or what can i do to stop the animation from being played again during scrolling?

    Thanks for your help!
    <?xml version="1.0" encoding="utf-8"?>
    <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                                  xmlns:fxg="fxgAssets.*"
                                  xmlns:components="components.*"
                                  >
    <!-- States ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <s:states>
              <s:State name="normal" />
              <s:State name="selected" />
         </s:states>
    <!-- Script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <fx:Script>
              <![CDATA[
                   // imports ------------------------------------
                   import mx.events.FlexEvent;
                   // event handlers -------------------------------------------
                   protected function editField(event:MouseEvent):void
                   protected function deleteField(event:MouseEvent):void
                   protected function initializeButton(s1:String,s2:String,event:FlexEvent):void
                        import fxgAssets.*;
                        editIcon;
                        editIcon2;
                        deleteIcon2;
                        deleteIcon;
                        var cls:Class=getDefinitionByName(s1) as Class;
                        event.target.img1=new cls();
                        cls=getDefinitionByName(s2) as Class;
                        event.target.img2=new cls();               
              ]]>
         </fx:Script>
    <!-- Declarations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <fx:Declarations>
         </fx:Declarations>
    <!-- Transitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <s:transitions>
                   <s:Transition fromState="normal" toState="selected" >
                             <s:Sequence duration="800" >
                                       <s:Parallel>                                       
                                            <s:Resize target="{this}" />                                       
                                            <s:Fade startDelay="500" target="{editButton}" />         
                                            <s:Fade startDelay="500" target="{deleteButton}" />              
                                            <s:Fade startDelay="500" target="{product}" />              
                                            <s:Fade startDelay="500" target="{date}" />              
                                            <s:Fade startDelay="500" target="{test6}" />              
                                       </s:Parallel>    
                                  </s:Sequence>                        
                   </s:Transition>                   
         </s:transitions>
    <!-- Graphics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <s:Rect width="100%" height="1" bottom="0">
              <s:fill>
                   <s:SolidColor color="0xe0e0e0" />
              </s:fill>
         </s:Rect>
         <s:Rect width="100%" height="100%" includeIn="selected">
              <s:fill>
                   <s:LinearGradient rotation="90">
                        <s:GradientEntry color="#ffba00" ratio="0" alpha="1"/>
                        <s:GradientEntry color="#ffba00" ratio="1" alpha="1"/>
                   </s:LinearGradient>
              </s:fill>
         </s:Rect>
         <s:Line id="test6" xFrom="15" xTo="225" yFrom="75" yTo="75" includeIn="selected" >
              <s:stroke>
                   <s:SolidColorStroke color="white" weight="5"/>
              </s:stroke>
         </s:Line>
    <!-- UI components ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
         <s:VGroup width="100%" >
              <s:HGroup width="100%" >
                   <s:HGroup width="50%"  horizontalAlign="left">
                        <s:Label id="fieldName" text="Acker 1" width="100%" paddingTop="25"  paddingBottom="25" fontSize.selected="31" fontWeight.selected="bold"/>         
                   </s:HGroup>
                   <s:HGroup width="50%" horizontalAlign="right">
                        <components:MainMenuButton click="editField(event)"
                                                         skinClass="skins.MainMenuButtonSkin"
                                                         preinitialize="initializeButton('fxgAssets.editIcon2','fxgAssets.editIcon',event)"
                                                         id="editButton" scaleX="2.5" scaleY="2.5" includeIn="selected"
                                                         />
                        <components:MainMenuButton click="deleteField(event)"
                                                         skinClass="skins.MainMenuButtonSkin"
                                                         preinitialize="initializeButton('fxgAssets.deleteIcon2','fxgAssets.deleteIcon',event)"
                                                         id="deleteButton" scaleX="2.5" scaleY="2.5" includeIn="selected"
                                                         />
                   </s:HGroup>
              </s:HGroup>
              <s:VGroup includeIn="selected" paddingBottom="5" paddingLeft="5" paddingRight="5" paddingTop="5"  >
                   <s:Label id="product" text="Produkt: Mais" width="100%" paddingBottom="10"/>
                   <s:Label id="date" text="Zeitraum: Di 01.01.2011 - Mi 02.02.2011" width="100%" paddingBottom="10"/>              
              </s:VGroup>
         </s:VGroup>
    </s:ItemRenderer>

  • Drag Event Problem in ItemRenderer

    Hi Everyone,
    I faced the problem in Drag Drop event occur in the Item Renderer. Here i attach the screen shot. If any one know the solution please let me know.
    Thanks in Advance,
    Charles

    Hi,
    Actually the Datagrid, label and text boxes are in one Canvas. I use this Canvas in One ItemRenderer.mxml and the data are comes from XML file. I Called that ItemRenderer.mxml file into my Main Screen.mxml file. So the ItemRender is repeated based on my Input Data.
    Thanks,
    Charles

  • Problem with Checkbox ItemRenderer in a DataGrid

    Hello Everyone,
    I'm using a datagrid with two columns, which is used as a data entry grid. The first column has a simple text input field and the 2nd column has a checkbox as an itemrenderer. On creationComplete event, I'm passing an arraycollection as the dataprovider for this datagrid. The arraycollection:
    <mx:ArrayCollection id="psAC">
            <mx:source>
                <mx:Array>
                    <mx:Object PaText="line1" PaCheckbox="0" />
                    <mx:Object PaText="line2" PaCheckbox="0" />
                    <mx:Object PaText="line3" PaCheckbox="1" />
                    <mx:Object PaText="line4" PaCheckbox="0" />
                    <mx:Object PaText="line5" PaCheckbox="0" />
                </mx:Array>
            </mx:source>
        </mx:ArrayCollection>
    There is a datagrid (dGa) in the main application. On click of this, a pop up window comes up which has the same datagrid layout(i.e, 2 columns). And this is where the data is entered. Here, if the user checks the check box, I have assigned a value of '1' for the 2nd column of the arraycollection. THis code(below) works fine.
    <datagrid in pop up window>
    <mx:DataGridColumn headerText="Best Possible Action?" textAlign="center" width="200" editable="false">
                                <mx:itemRenderer>
                                    <mx:Component>
                                       <mx:CheckBox>
                                            <mx:Script>
                                                    <![CDATA[
                                                         override public function set data(value:Object):void{
                                                             if(value.PaCheckbox == 1){
                                                                this.selected = true;
                                                            }else{
                                                                this.selected = false;
                                                    ]]>
                                                </mx:Script>
                                            <!--<mx:change>
                                                <![CDATA[
                                                    if(this.selected == true){
                                                         data.PaCheckbox = 1;
                                                     }else{
                                                         data.PaCheckbox = 0;
                                                ]]>
                                            </mx:change>-->
                                        </mx:CheckBox>
                                    </mx:Component>
                                </mx:itemRenderer>
                            </mx:DataGridColumn>
    But I would also need to set the PaCheckbox value to 0 or 1, based on teh check condition of the check box. I tried using change event (commented in the code above). But there I get an error: Cannot access a property or method of a null object reference. I checekd in debug mode, there the data object is null! Can you please help me on how to pass back the values(0 o 1) to my arraycollection, based on the checkbox's status?
    Cheers,
    Deepak

    heyo,
    I solved it.....
    i was missing this line of code super.data = value; in the ovverriden function...Once we have this line, the data object will have teh field names and their values in it, which can be accessed on the change event...

  • Problem in accessing the itemRenderer dynamically

    Hi,
         In my application i am using two AdvanceddataGrids. i am showing one datagrid at a time based on the user selection. I have provided the buttons to switch between the grids. These two datagrids are getting the data from XML. By default the data will be available for the first datagrid in XML. Once the user selects the second grid, i am using the HTTPService to fetch the data for that particular grid. (This HTTPService will pass this grid's id as QueryString to the same XML page, and the .Net will read these parameters to fetch the required data from the DB and will print the data in the XML format in the same page).
         Here, for the first datagrid, i have used the itemRenderer to show some images (in the datagrid) based on the data available in XML. And i have followed the same for the second grid also.
         But the probelm is, whenever the application starts runnning (on Creation complete of the application), i am not able to view the images for the first datagrid, since the data for the second datagrid is not available (i have defined the itemRenderer for the second dataGrid based on XML data).
         I have stored the itemRenderers for each datagrid as a separate component. Is there any way to add this itemRenderer component during the run time. (While the user clicks the button to view the second datagrid)?
         "(Second datagrid's) coloumnid.itemRenderer = mycomponent.mxml"  (I have tried this code to access during selection of second datagrid. But it didn't work).
         Could someone help me on this?

    When you say:
    But the probelm is, whenever the application starts runnning (on Creation complete of the application), i am not able to view the images for the first datagrid, since the data for the second datagrid is not available (i have defined the itemRenderer for the second dataGrid based on XML data).
    I don't understand. Why would the images in the first datagrid not be availabe because the data for the second grid is not available?
    If certain data needs to be loaded for creationComplete, then ensure it is loaded.
    Perhaps you can clarify these points as your scenario is not clear.

  • Problem updateDisplayList in itemRenderer

    Hello!
    I directed at you, because I'm a little lost.
    (Sorry for my English)
    I'm relatively new to Flex and I'm finding some
    problems, which I try out.
    One of the biggest I have is the following:
    I made a custom chart, from a
    <mx:LineChart> with different rendereres. In the method
    updateDisplayList () for each one, drawing the elements that need.
    The graph contains data of a measure, for the last 3 months
    but only shows 20 days. You can scroll through the graph
    clicking an arrow I added outside of the graph.
    When I create the graph, passed several times by the updateDisplayList ();
    CustomAxisHorizontalRenderer (2 times)
    CustomAxisVerticalRenderer (2 times)
    CustomGridRenderer (1 time)
    CustomCircleItemRenderer (40 times for the 40 data
    I have three months)
    Not because he needs to spend 40 times by the
    CustomCircleItemRenderer.updateDisplayList if I only see 10 data, and if
    is because when I move one day backward, re-
    call again around the same time renderers.
    Not if you have something to do with cacheAsBitmap or invalidateDisplayList
    I am not using.
    All this is making the application (and I use this component
    enough) is slow, and I this desperate with Flex.
    Hopefully you can help me

    Some of the spark containers have a useVirtualLayout property that will allow your itemRenderers to be recycled if set to true. See http://help.adobe.com/en_US/flex/using/WS64909091-7042-4fb8-A243-8FD4E2990264.html#WS486D1 976-E12C-4654-B330-3DF3B23614F6 for more info. I'm not sure if LineChart supports this property in flex 4.x, if it doesn't you may have to base your component off of something that does.

Maybe you are looking for