That's fine and probalby looks better than a stack of ComboBoxes, but
you could still do it the original way by setting itemIsRenderer.

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Steve Gustafson
Sent: Friday, March 02, 2007 1:44 PM
To: [email protected]
Subject: Re: [flexcomponents]PROBLEM SOLVED! Struggling with
itemRenderer in DataGrid



After solving the first part of the puzzle with the following:

private function getLevelsForCBResult(event:Object):void
{
    public var cbRenderer:ClassFactory = new ClassFactory(comboR);
    myCBData = event.result as ArrayCollection;
    cbRenderer.properties = {dataProvider:myCBData};      
}

I figured out that what I really needed to do was use an itemEditor
instead of an itemRenderer for my purposes.

public function createPositionTable():void 
{
    adminTablesCFC.getLevelsForCB();

    _col1 = new DataGridColumn;
    _col2 = new DataGridColumn;
    _col3 = new DataGridColumn;
    _col4 = new DataGridColumn;
    _col5 = new DataGridColumn; 
    _col6 = new DataGridColumn;

    _col1.headerText= "Position";
    _col1.dataField = "Description";
    _col1.editable = true;
    _col1.width = 100;    

    _col2.dataField = "Type"; 
    _col2.headerText= "Type";
    _col2.editable = true;
    _col2.width = 50;    

    _col3.dataField = "levelDescription";
    _col3.headerText = "Level";
    _col3.width = 150; 
    _col3.editable = true;
    _col3.itemEditor = cbLevelsRenderer;  // HERE IS WHERE I AM USING
THE itemEditor
    _col3.editorDataField = "text";


    _col4.dataField = "Active";
    _col4.headerText = "Active";
    _col4.width = 50;
    _col4.editable = false;
    _col4.itemRenderer = new ClassFactory(delCheckbox);
    _col4.editorDataField = "Active";


    _col5.dataField = "ID"; 
    _col5.headerText= "PositionID";
    _col5.editable = false;
    _col5.visible = false;
    _col5.width = 50;    

    _columns = new Array(_col1,_col2,_col3,_col4,_col5);
    buildGrid(); 
    updateTablesButton.label = 'Update Positions Table';    
}

So now, I am creating dataGrids on the fly, with comboBoxes for
itemEditors that are also created on the fly.

This is now working great! 

Thanks for everyones help.

Steve


On 3/2/07, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote: 

        

        You'll have to override the data setter.
         
        override public function set data(value:Object):void
        {
        }
         
        The value object contains the data for an entire row in the
DataGrid.  If you can then calculate the selectedIndex based on the data
in the row, you are set to go.
         
         

________________________________

        From: [email protected]
<mailto:[email protected]>
[mailto:[email protected] <mailto:[EMAIL PROTECTED]> ] On
Behalf Of Steve Gustafson
        Sent: Friday, March 02, 2007 8:36 AM
        To: [email protected]
<mailto:[email protected]> 
        Subject: Re: [flexcomponents] Struggling with itemRenderer in
DataGrid
        
        
        That is exactly the solution I hit upon this morning.
        
        Now I am trying to work through how to have a different
selectedIndex in the ItemRenderer for each row in the datagrid.
        
        Any thoughts?
        
        Thanks,
        Steve 
        
        

        On 3/2/07, jwopitz <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> wrote: 

                I would try this.
                
                var cf:ClassFactory = new
ClassFactory(yourItemRenderer);
                cf.properties = {dataProvider:myCBData};
                
                col3.itemRenderer = cf.

                
                
                
                
                

        

        

        

        


 

Reply via email to