Hi Satish,

 Thanks for the reply. I tried out the sample you gave with little
modifications.
 Here I'm able to grey out but I want to disable the selection of
those particular items in the combo.
 Here I'm attaching my sample. Can you look at it once.

SampleApp.mxml
=============

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
    verticalAlign="top" backgroundColor="white">
    <mx:Script>
        <![CDATA[
        import mx.collections.ArrayCollection;
        [Bindable]
        public var cards:ArrayCollection = new ArrayCollection (
                [ {label:"Apple", data:1},
                  {label:"Banana", data:2},
                  {label:"Cherry", data:2},
                  {label:"Tamarind", data:2},
                  {label:"Grapes", data:2},
                  {label:"Tomato", data:3} ]);

        ]]>
    </mx:Script>

    <mx:ComboBox id="comboBox" prompt="Please select a State..."
        dataProvider="{cards}" rowCount="3"
itemRenderer="ComboBoxItemRenderer" width="200" />

</mx:Application>


ComboBoxItemRenderer.mxml
======================

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

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml";>
    <mx:Script>
        <![CDATA[
        import mx.collections.ArrayCollection;

        [Bindable]
        public var fruits:Array = new Array ("Apple", "Cherry");

        private function checkFruitValid(label:String):Boolean {
            if(fruits.length == 0)
                return true;
            else {
                for(var i:int=0; i<fruits.length; i++) {
                    if(fruits[i] == label)
                        return true;
                }
            }
            return false;
        }
        ]]>
    </mx:Script>

<mx:Label enabled="{checkFruitValid(data.label)}" text="{data.label}" /
>

</mx:VBox>


Thanks,
Anil








On Nov 18, 6:48 pm, "Sathish Kumar"
<[EMAIL PROTECTED]> wrote:
> Anil,
> You can use Custom Combo box item Renderers for this ...
>
> SampleApp.mxml
>
> <?xml version="1.0" encoding="utf-8"?>
> <!--http://blog.flexexamples.com/2007/09/25/creating-a-custom-combobox-it...>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
>         layout="vertical"
>         verticalAlign="top"
>         backgroundColor="white">
>         <mx:Script>
>          <![CDATA[
>          import mx.collections.ArrayCollection;
> [Bindable]
>             public var cards:ArrayCollection = new ArrayCollection(
>                 [ {label:"Apple", data:1},
>                   {label:"Banana", data:2},
>                   {label:"Cherry", data:2},
>                   {label:"Tamarind", data:2},
>                   {label:"Grapes", data:2},
>                   {label:"Tomato", data:3} ]);
>
>          ]]>
>         </mx:Script>
>
>     <mx:ComboBox id="comboBox"
>             prompt="Please select a State..."
>             dataProvider="{cards}"
>             rowCount="3"
>             itemRenderer="ComboBoxItemRenderer" width="200" />
>
> </mx:Application>
>
> ComboBoxItemRenderer.mxml
>
> <?xml version="1.0" encoding="utf-8"?>
> <!--http://blog.flexexamples.com/2007/09/25/creating-a-custom-combobox-it...>
> <mx:Button xmlns:mx="http://www.adobe.com/2006/mxml";
>         enabled="{ (data.label == 'Banana' || data.label == 'Cherry') }"
>         label="{data.label +  ' => Enable = ' + (data.label == 'Banana' ||
> data.label == 'Cherry') }"
>
> </mx:Button>
>
> Hope this helps ....
>
> -Sathish
>
>
>
> On Tue, Nov 18, 2008 at 6:08 PM, Anil <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> >  Can any one suggest me in graying out some data in combo box.
>
> >  Eg: Combo Box data will be having Apple, Banana, Tomato, Cherry,
> > Tamarind, Grapes.
> >       How can I grey out Banana and Cherry. I mean selection should
> > be enabled on these data.
>
> >  Any suggestions ???
>
> > Thanks,
> > Anil
>
> --
> Warm Regards,
> Sathish Kumar T
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to