3 Replies Latest reply on Nov 1, 2010 10:22 AM by jazterix

    AdvancedDataGrid - TypeError: Error #1034: Type Coercion failed

    jazterix

      In my app I have this componenent:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%"
               xmlns:taskpanel="components.taskpanel.*">

       

        <mx:AdvancedDataGrid id="myADG">


          <mx:dataProvider>
            <mx:HierarchicalData source="{tasks}" childrenField="task"/>
          </mx:dataProvider>


          <mx:columns>

            <mx:AdvancedDataGridColumn id="status" headerText="Status" dataField="status"/>

          </mx:columns>

       

          <mx:rendererProviders>

            <mx:AdvancedDataGridRendererProvider column="{status}">

              <mx:renderer>

                <fx:Component>

                  <taskpanel:GridDropDownList/>

                </fx:Component>

              </mx:renderer>

            </mx:AdvancedDataGridRendererProvider>

          </mx:rendererProviders>

       

        </mx:AdvancedDataGrid>

       

      </s:Group>

       

      Here is how the grid data looks like:

       

      <task id="1" name="task1" status="1" percent_complete="0" updated_at="Tue Mar 02 12:11:20 EET 2010" created_at="Tue Mar 02 12:11:20 EET 2010" priority="1">
        <user id="1" email="user1@email.com" phone="12345" responsibility="developer" username="user1"/>
        <user id="2" email="user1@email.com" phone="12345" responsibility="CEO" username="user2"/>
        <task id="2" name="task2" status="1" percent_complete="50" updated_at="Tue Mar 02 12:11:20 EET 2010" created_at="Tue Mar 02 12:11:20 EET 2010" priority="2">
          <user id="1" email="user1@email.com" phone="12345" responsibility="developer" username="user1"/>
        </task>
      </task>

       

      Here is taskpanel.GridDropDownList:

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                focusEnabled="true">
        <s:Label id="lblData" top="0" left="0" right="0" bottom="0" text="test" />
      </s:MXDataGridItemRenderer>

       

      When I try to run it, I get the following stacktrace:

       

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls::AdvancedDataGrid@47fea011 to mx.controls.listClasses.ListBase.
          at mx.controls.listClasses::MXItemRenderer/commitProperties()[E:\dev\4.0.0\frameworks\projec ts\spark\src\mx\controls\listClasses\MXItemRenderer.as:212]
          at mx.core::UIComponent/validateProperties()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:7772]
          at mx.managers::LayoutManager/validateClient()[E:\dev\4.0.0\frameworks\projects\framework\sr c\mx\managers\LayoutManager.as:863]
          at mx.controls.advancedDataGridClasses::AdvancedDataGridBase/layoutRow()[E:\dev\4.0.0\framew orks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedDataGridBa se.as:1997]
          at mx.controls.advancedDataGridClasses::AdvancedDataGridBase/createRow()[E:\dev\4.0.0\framew orks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedDataGridBa se.as:1871]
          at mx.controls.advancedDataGridClasses::AdvancedDataGridBase/makeRowsAndColumns()[E:\dev\4.0 .0\frameworks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedD ataGridBase.as:836]
          at mx.controls::AdvancedDataGridBaseEx/makeRowsAndColumns()[E:\dev\4.0.0\frameworks\projects \datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:2212]
          at mx.controls::AdvancedDataGrid/makeRowsAndColumns()[E:\dev\4.0.0\frameworks\projects\datav isualization\src\mx\controls\AdvancedDataGrid.as:1999]
          at mx.controls.listClasses::AdvancedListBase/makeRowsAndColumnsWithExtraRows()[E:\dev\4.0.0\ frameworks\projects\datavisualization\src\mx\controls\listClasses\AdvancedListBase.as:3994 ]
          at mx.controls.listClasses::AdvancedListBase/updateDisplayList()[E:\dev\4.0.0\frameworks\pro jects\datavisualization\src\mx\controls\listClasses\AdvancedListBase.as:3566]
          at mx.controls::AdvancedDataGridBaseEx/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\ datavisualization\src\mx\controls\AdvancedDataGridBaseEx.as:2015]
          at mx.controls::AdvancedDataGrid/updateDisplayList()[E:\dev\4.0.0\frameworks\projects\datavi sualization\src\mx\controls\AdvancedDataGrid.as:2899]
          at mx.controls.listClasses::AdvancedListBase/validateDisplayList()[E:\dev\4.0.0\frameworks\p rojects\datavisualization\src\mx\controls\listClasses\AdvancedListBase.as:3468]
          at mx.managers::LayoutManager/validateDisplayList()[E:\dev\4.0.0\frameworks\projects\framewo rk\src\mx\managers\LayoutManager.as:663]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:736]
          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1072]

       

      Thanks in advance.