Hi Sam,

    It work's fine and thanks for your help.Same way i did it in my
previous application but i couldn't remember and after seeing your
post i came to know that but any way thanks for your help.

    If you don't mine, can you tell me how to do the same thing in
action script.Now am trying to do it action script.

Thanks
  sankar

On Mar 13, 11:17 pm, "[email protected]" <[email protected]>
wrote:
> Yes Sankar it is possible, you just have to pass the data from the
> main item renderer to the other components, for this you can create
> some bindable public property in the other components and bind the
> value from your data in the item renderer to the other components,
>
> like following can be the code of your component:
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";>
>         <mx:Script>
>                 <![CDATA[
>
>                         [Bindable]
>                         public var itemData:Object;
>                 ]]>
>         </mx:Script>
>         <mx:HBox width="100%" paddingRight="15">
>                 <mx:Label text="{itemData.priority}"/>
>                 <mx:Label text="{itemData.category}"/>
>     </mx:HBox>
> </mx:Canvas>
>
> And your item renderer bind the itemData property to the data property
> like this:
>
> ItemRendererExample
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> xmlns:comp="components.*">
>         <mx:HBox width="100%" paddingRight="15">
>                     <comp:Comp1 itemdata="{data}"/>
>                     <comp:Comp2/>
>         </mx:HBox>
> </mx:Canvas>
>
> -Sambhav
>
> On Mar 13, 6:56 pm, Sankar <[email protected]> wrote:
>
> > Hi All,
>
> > As we all know that, we can define the itemRenderer as a component
> > class or file i.e whether it can be in MXML or in ActionScript and
> > with the help of containers say HBox/VBox/Canvas etc controls can be
> > lay down, values can be displayed using the data property as shown
> > below.
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > layout="absolute">
>
> >     <mx:Script>
> >     <![CDATA[
> >         import mx.collections.ArrayCollection;
>
> >         [Bindable]
> >         private var initData:ArrayCollection = new ArrayCollection([
> >         {task:"meet ravi on
> > sunday",category:"personal",priority:"Low",dueDate:"09-mar-09"},
> >         {task:"buy a
> > book",category:"friends",priority:"Medium",dueDate:"07-mar-09"},
> >         {task:"play
> > cricket",category:"friends",priority:"Low",dueDate:"15-mar-09"},
> >         ]);
> >     ]]>
> >     </mx:Script>
>
> >     <mx:List dataProvider="{initData}" width="50%" height="50%"
> >     itemRenderer="components.ItemRendererExample"/>
>
> > </mx:Application>
>
> >     components.ItemRendererExample file
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> > xmlns:dueDate="components.*">
>
> >     <mx:HBox width="100%" paddingRight="15">
> >     <mx:Label text="{data.task}" width="100%"/>
> >     <mx:Label text="{data.dueDate}"/>
> >     <mx:Label text="{data.priority}"/>
> >     <mx:Label text="{data.category}"/>
> >     </mx:HBox>
>
> > </mx:Canvas>
>
> > Now my question is instead of displaying all the values in component
> > file can I display 2 of the values in component file and the 2 other
> > values in another component file and finally these components can be
> > included in the main component file(ItemRendererExample)? as shown
> > below
>
> >   <mx:List itemRenderer = "components.ItemRendererExample" ..../>
>
> >     ItemRendererExample
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> > xmlns:comp="components.*">
>
> >         <mx:HBox width="100%" paddingRight="15">
> >                     <comp:Comp1/>
> >                     <comp:Comp2/>
> >         </mx:HBox>
>
> > </mx:Canvas>
>
> >         Comp1
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";>
>
> >         <mx:HBox width="100%" paddingRight="15">
> >                 <mx:Label text="{data.task}" width="100%"/>
> >                 <mx:Label text="{data.dueDate}"/>
> >         </mx:HBox>
>
> > </mx:Canvas>
>
> >         Comp2
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";>
>
> >         <mx:HBox width="100%" paddingRight="15">
> >                 <mx:Label text="{data.priority}"/>
> >                 <mx:Label text="{data.category}"/>
> >         </mx:HBox>
>
> > </mx:Canvas>
>
> > I know that, in this case we can't directly use the data property as
> > {data.task} in the components which are outside of ItemRendererExample
> > component file. Is it possible by doing ant other extra things?
>
> > Any help can be appreciated. It can be either in MXML or ActionScript
>
> > Thanks
> > -sankar

--~--~---------~--~----~------------~-------~--~----~
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