Problem assigning data to an itemRenderer component

Posted on 2009-04-24
Last Modified: 2012-05-06
I actually asked this question before, and I was given the recommendation to look at I have a datagrid that has a column defined this way:

<mx:DataGridColumn id="dgc" headerText="Gender" itemRenderer="itemrenderers.ComboBoxRenderer" editable="false"/>

The code of itemrenderers.ComboboxRenderer is simply this:

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx=""
                  import mx.collections.ArrayCollection;
                  public var dp:ArrayCollection;

My objective is to pass the following mx:Model to itemrenderers.ComboBoxRenderer to serve as its dataProvider:

<mx:Model id="modelGender">
            <sex index="M" text="Male"/>
            <sex index="F" text="Female"/>

Now following the instructions which leads to, I have a function called setupDataGrid() which is called upon my datagrid's (whose id is "dg1") creationComplete event:

            private function setupDataGrid():void
                  var myComboBoxRenderer:ClassFactory = new ClassFactory(itemrenderers.ComboBoxRenderer);
         = { dp:};
                  dg1.itemRenderer = myComboBoxRenderer;


But when I run it, I get this error:

"TypeError: Error #1034: Type Coercion failed: cannot convert []@158b7d99 to mx.collections.ArrayCollection.
      at mx.core::ClassFactory/newInstance()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\]
      at mx.controls.dataGridClasses::DataGridColumn/[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\dataGridClasses\]
      at mx.controls::DataGrid/commitProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\controls\]
      at mx.core::UIComponent/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\]
      at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\]
      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\]
      at Function/
      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\]
      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\]"

It is erroring out during the assignment of (an ArrayCollection object) to the 'dp' property of my itemrenderers.ComboBoxRenderer, and I'm at a loss now. :(

Can anyone see what I'm doing wrong? Thanks.
Question by:elepil
    LVL 37

    Accepted Solution

    >> It is erroring out during the assignment of (an ArrayCollection object)
    Are you sure that is an ArrayCollection?

    The error says: "... cannot convert []".
    Looks like is more like an Array instead of an ArrayCollection

    Could you try changing

   = { dp:};


   = { dp: new ArrayCollection( };

    Author Closing Comment

    Thank you for responding when nobody did, I really appreciate it. :)
    LVL 37

    Expert Comment

    You're welcome
    Thanx 4 axxepting

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now