Well rather than try to email the MXML file to you, I am just gonna
copy and paste the code here. Its all in one file, but you can break
it up if you like into your own components. I developed this to demo
the ability to have individual records with combo box attributes that
are interdependant. Try it out.

App begins below:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Script>
        <![CDATA[

            [Bindable]
            public var opt1Items: Array = [ 
            {label:"Select One", data:0},
            {label:"Canned Goods", data:1},
            {label:"Fresh Fruit", data:2}, 
            {label:"Meat", data:3} ];
            
            public var CGASubItems: Array = [ 
            {label:"Canned Goods A opt 1", data:1},
            {label:"Canned Goods A opt 2", data:2}, 
            {label:"Canned Goods A opt 3", data:3} ];
            
            public var CGBSubItems: Array = [ 
            {label:"Canned Goods B opt 1", data:1},
            {label:"Canned Goods B opt 2", data:2}, 
            {label:"Canned Goods B opt 3", data:3} ];
                        
                        public var FFASubItems: Array = [ 
            {label:"Fresh Fruit A opt 1", data:1},
            {label:"Fresh Fruit A opt 2", data:2}, 
            {label:"Fresh Fruit A opt 3", data:3} ];
            
            public var FFBSubItems: Array = [ 
            {label:"Fresh Fruit B opt 1", data:1},
            {label:"Fresh Fruit B opt 2", data:2}, 
            {label:"Fresh Fruit B opt 3", data:3} ];
            
            public var MeatASubItems: Array = [ 
            {label:"Meat A opt 1", data:1},
            {label:"Meat A opt 2", data:2}, 
            {label:"Meat A opt 3", data:3} ];
            
            public var MeatBSubItems: Array = [ 
            {label:"Meat B opt 1", data:1},
            {label:"Meat B opt 2", data:2}, 
            {label:"Meat B opt 3", data:3} ];
            
            public var sel2Default: Array = [ 
            {label:"Combo 2 Default", data:1} ];
            
             public var sel3Default: Array = [ 
            {label:"Combo 3 Default", data:1} ];
            
            [Bindable]
                public var sel2dp:Object = sel2Default;
                
                [Bindable]
                public var sel3dp:Object = sel3Default;
                
            [Bindable]
            public var selectedItem:Object; 
            
            public function changeSelectBoxes(selected:Object):void
            {
                //trace(selected.data);
                switch (selected.data) {
                                        case 0:
                                        sel2dp = sel2Default;
                                        sel3dp = sel3Default;
                                //trace(0);
                                break;
                                
                                        case 1:
                                        sel2dp = CGASubItems;
                                        sel3dp = CGBSubItems;
                                //trace(1);
                                break;
                                
                                case 2:
                                sel2dp = FFASubItems;
                                        sel3dp = FFBSubItems;
                                //trace(2);
                                break;
                                
                                case 3:
                                sel2dp = MeatASubItems;
                                        sel3dp = MeatBSubItems;
                                //trace(3);
                                break;
                                
                                default:
                                //trace("default");
                                }
            }       
        ]]>
    </mx:Script>
        
        <mx:Panel x="21" y="123" width="702" height="200" layout="absolute"
title="Mini Component Test">
                <mx:Label x="0" y="12" text="Combo 1"/>
                <mx:Label x="232" y="12" text="Combo 2"/>
                <mx:Label x="455" y="12" text="Combo 3"/>
                <mx:Grid x="10" y="80" width="456">
                        <mx:GridRow width="100%" height="100%">
                                <mx:GridItem width="100%" height="100%">
                                        <mx:ComboBox id="comboBox1" 
dataProvider="{opt1Items}"
change="changeSelectBoxes(comboBox1.selectedItem)"></mx:ComboBox>
                                </mx:GridItem>
                                <mx:GridItem width="100%" height="100%">
                                        <mx:ComboBox id="comboBox2" 
dataProvider="{sel2dp}"></mx:ComboBox>
                                </mx:GridItem>
                                <mx:GridItem width="100%" height="100%">
                                        <mx:ComboBox id="comboBox3" 
dataProvider="{sel3dp}"></mx:ComboBox>
                                </mx:GridItem>
                        </mx:GridRow>
                </mx:Grid>
        </mx:Panel>
        
</mx:Application>


--- In [email protected], "Clint Tredway" <[EMAIL PROTECTED]> wrote:
>
> I need an example of using a combo box in a datagrid.. I have looked
> around and cant find one..
> 
> -- 
> diabetic? http://www.diabetesforums.com
> Albert Einstein - "It's not that I'm so smart, it's just that I stay
> with problems longer."
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to