0 Replies Latest reply on Sep 7, 2010 8:17 AM by lionkingdom

    Item render a button in Datagrid

    lionkingdom

       

      Needed some help. I was trying to create a button inside an AdvancedDatagrid dynamically. I figure Item Renderer is the way to go. This is the first time I am dealing with Item Renderer.

       

      But I am getting this error

       

      “TypeError: Error #1034: Type Coercion failed: cannot convert components::passwordButton$ to mx.core.ClassFactory.”

       

      ------------------------------------------------------------------------

       

      thsi is my Datagrdi declaration

      <mx:AdvancedDataGrid id="reportResultGrid_B" height="100%" width="100%"  horizontalScrollPolicy="auto" verticalScrollPolicy="auto"    />

       

      -----------------------------------------------------------------------

       

      reportResultGrid_B.dataProvider=acTmp; //assign a array collection to the datagrid

       

      ---------------------------------------------------------------------------------------

       

       

       

            for each(var dgc:AdvancedDataGridColumn in reportResultGrid_B.columns )

       

           {  

                 if(dgc.headerText=="ItemPassword")

       

                 {  

                       dgc.itemRenderer=ClassFactory(passwordButton);

        //if I comment above line out then everything works fine

       

                 }          

       

           }

       

       

      -------------------------------------------------------

       

       

       

       

      This is my passwordButton.mxml

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="50" height="50">

            <mx:Button label="Reveal password"/>     

           

      </mx:HBox>