How To Access ComboBox's properties from its item renderer

113 views
Skip to first unread message

comgeek

unread,
Jan 2, 2010, 5:04:45 AM1/2/10
to Flex India Community
my Code is like this

<mx:ComboBox labelField="name">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput text={data[labelField]} />
</mx:Component>
</mx:itemRenderer>
</mx:ComboBox

In itemrenderer I want to get the labelField property of the combobox
but how can I get it..

when I used this.parent in itemrenderer its showing some 'ListBast and
not the 'ComboBox'

Kiran Kumar Vasireddy

unread,
Jan 4, 2010, 9:59:19 AM1/4/10
to flex_...@googlegroups.com
Did you try giving an Id to combox and tried accessing it directly or by using outerDocument ?

Regards
Kirab


--

You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.



Ganga Ambika

unread,
Jan 5, 2010, 1:00:32 AM1/5/10
to flex_...@googlegroups.com
Use like this


<mx:ComboBox labelField="name">
   <mx:itemRenderer>
       <mx:Component>
            <mx:TextInput text={data.name}    />

       </mx:Component>
 </mx:itemRenderer>
</mx:ComboBox

--

You received this message because you are subscribed to the Google Groups "Flex India Community" group.
To post to this group, send email to flex_...@googlegroups.com.
To unsubscribe from this group, send email to flex_india+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.





--
Thanks,
Ganga

"Start by doing what is necessary, then what is possible, and suddenly
you are doing the impossible."


comgeek

unread,
Jan 4, 2010, 2:44:55 PM1/4/10
to Flex India Community
I can do that., but I want to do it I want to do this as a (reusable
custom component).. so I tried using 'parent.' but 'parent' from
itemrenderer is pointing to Listbox(dropdown of combobox), and I also
used 'parent.parent' but no use..

Is there any other way?

On Jan 4, 7:59 pm, Kiran Kumar Vasireddy <kiranv...@gmail.com> wrote:
> Did you try giving an Id to combox and tried accessing it directly or by
> using outerDocument ?
>
> Regards
> Kirab
>

> On Sat, Jan 2, 2010 at 5:04 AM, comgeek <munagaprav...@gmail.com> wrote:
> > my Code is like this
>
> > <mx:ComboBox labelField="name">
> >    <mx:itemRenderer>
> >        <mx:Component>
> >             <mx:TextInput text={data[labelField]}    />
> >        </mx:Component>
> >  </mx:itemRenderer>
> > </mx:ComboBox
>
> > In itemrenderer I want to get the labelField property of the combobox
> > but how can I get it..
>
> > when I used this.parent in itemrenderer its showing some 'ListBast and
> > not the 'ComboBox'
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Flex India Community" group.
> > To post to this group, send email to flex_...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > flex_india+...@googlegroups.com<flex_india%2Bunsu...@googlegroups.com>

raj

unread,
Jan 6, 2010, 10:43:38 PM1/6/10
to Flex India Community
Hi,

You can try this.

/** CustomComboBox.mxml**/
<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:itemRenderer>
<mx:Component>
<mx:TextInput text="{data.outerDocument.labelField}" />


</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>

/** Sample.mxlml **/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" xmlns:local="*">
<mx:Array id="arr">
<mx:Object label="Student A" score="85" />
<mx:Object label="Student B" score="48" />
<mx:Object label="Student C" score="71" />
</mx:Array>
<local:CustomComboBox dataProvider="{arr}" labelField="score" />
<local:CustomComboBox dataProvider="{arr}" labelField="label" />
</mx:Application>

With regards,
RajPrabha

> > > flex_india+...@googlegroups.com<flex_india%2Bunsubscribe@googlegrou­ps.com>


> > > .
> > > For more options, visit this group at

> > >http://groups.google.com/group/flex_india?hl=en.- Hide quoted text -
>
> - Show quoted text -

raj

unread,
Jan 6, 2010, 10:34:52 PM1/6/10
to Flex India Community
Hi,

Create a custom combo box and use outerDocument.labelField to get
combo box's labelField.
Check the following code. If you find any other better solution, plz
post it.

/**CustomComboBox.mxml**/

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:itemRenderer>
<mx:Component>
<mx:TextInput text="{data[outerDocument.labelField]}" />


</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>

/**Sample.mxml**/


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical" xmlns:local="*">

<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>


<mx:Object label="Student A" score="85" />
<mx:Object label="Student B" score="48" />
<mx:Object label="Student C" score="71" />
</mx:Array>

</mx:source>
</mx:ArrayCollection>
<local:CustomComboBox dataProvider="{arrColl}" labelField="score" />
<local:CustomComboBox dataProvider="{arrColl}" labelField="label" />
</mx:Application>

With regards,
RajPrabha

On Jan 5, 12:44 am, comgeek <munagaprav...@gmail.com> wrote:

> > > flex_india+...@googlegroups.com<flex_india%2Bunsubscribe@googlegrou­ps.com>


> > > .
> > > For more options, visit this group at

comgeek

unread,
Jan 7, 2010, 2:11:04 AM1/7/10
to Flex India Community
Hi Raj Prabha this worked Thank You :)

> > > >http://groups.google.com/group/flex_india?hl=en.-Hide quoted text -

raj

unread,
Jan 7, 2010, 7:02:55 AM1/7/10
to Flex India Community
Hi,

Really sorry for the previous post.

In that example, item renderer [TextInput] is not displaying.
Use the following code.

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:itemRenderer>
<mx:Component>

<mx:HBox>
<mx:TextInput width="100%" height="100%" text="{data
[outerDocument.labelField]}" />
</mx:HBox>


</mx:Component>
</mx:itemRenderer>
</mx:ComboBox>


Worry for the inconvenience

Raj


On Jan 7, 8:34 am, raj <mrspra...@gmail.com> wrote:

> > > >http://groups.google.com/group/flex_india?hl=en.-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -

Reply all
Reply to author
Forward
0 new messages