Hi Ravi Mishra, I already have seen this example but it doesn't help me . In this example data getting displayed with the help of DataGridColumn and in the itemRenderer written in actionScript just does the decoration by overriding the setter for data property.
But what am i trying to do is i wanted to laydown the controls also in the action script itself like how we use the containers say HBox in the custom itemRenderer in MXML and data proprty. I think in this case the link what you send doesn't help me. Thanks sankar On Mar 11, 1:52 pm, Ravi Mishra <[email protected]> wrote: > Hi Sankar, > > You are on the wrong way. This is not the way you write an > itemRenderer. Please refer the folllowing link to get a clear idea > about itemrenderers in actionscript. > > http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/ww... > > HTH, > > -Ravi > > On Mar 11, 9:31 am, Sankar <[email protected]> wrote: > > > Hi All, > > > am trying to build item renderer for a List component in action > > script rather than in mxml. In the action script class am creating a > > HBox dynamically and adding Labels to is by overriding the > > createChildern() and also overriding the updateDisplayList() and > > commitProperties() and in which am setting the values to labels. > > > When i run the application in debug mode am able to see the > > values being set to the labels but am not seeing the values getting > > displayed in the List control. > > > Here am posting the code,so that the problem can be > > identified. > > > Can anyone help me how to resolve this problem? > > > <?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:"pay bill", > > category:"Office",priority:"Medium"}, > > {task:"meet ravi on > > sunday",category:"personal",priority:"Low"}, > > {task:"buy a > > book",category:"friends",priority:"Medium"}, > > {task:"play > > cricket",category:"friends",priority:"Low"}, > > ]); > > ]]> > > </mx:Script> > > > <mx:List dataProvider="{initData}" width="50%" height="50%" > > itemRenderer="components.RendererInAS"/> > > </mx:Application> > > > ItemRenderer file : > > > package components > > { > > > import mx.containers.HBox; > > import mx.controls.Label; > > import mx.controls.listClasses.BaseListData; > > import mx.controls.listClasses.IDropInListItemRenderer; > > import mx.controls.listClasses.IListItemRenderer; > > import mx.core.UIComponent; > > import mx.events.FlexEvent; > > > public class RendererInAS extends UIComponent implements > > IListItemRenderer { > > > public function RendererInAS() { > > super(); > > } > > > // Internal variable for the property value. > > private var _data:Object; > > > private var _listData:BaseListData; > > > // Make the data property bindable. > > [Bindable("dataChange")] > > > // Define the getter method. > > public function get data():Object { > > return _data; > > } > > > // Define the setter method, and dispatch an event when the > > property > > // changes to support data binding. > > public function set data(value:Object):void { > > _data = value; > > > invalidateProperties(); > > dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE)); > > } > > > private var hBox:HBox; > > private var task:Label; > > private var category:Label; > > private var priority:Label; > > > override protected function createChildren():void { > > super.createChildren(); > > > hBox = new HBox(); > > > task = new Label(); > > category = new Label(); > > priority = new Label(); > > hBox.addChild (task); > > hBox.addChild (category); > > hBox.addChild (priority); > > } > > > override protected function commitProperties():void { > > super.commitProperties(); > > > hBox.horizontalScrollPolicy = 'off'; > > hBox.verticalScrollPolicy = 'off'; > > > hBox.percentWidth = 100; > > > task.text = _data.task; > > category.text = _data.category; > > priority.text = _data.priority; > > } > > > override protected function updateDisplayList > > (unscaledWidth:Number, unscaledHeight:Number):void { > > super.updateDisplayList(unscaledWidth,unscaledHeight); > > hBox.move(0,0); > > hBox.setActualSize( (unscaledWidth-4), > > unscaledHeight); > > } > > } > > > } > > > 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 -~----------~----~----~----~------~----~------~--~---

