Datagrid Checkbox item renderer Issue.

Hi There
Recently I faced a  requirement to have a checkbox inside a datagrid where I need to develop a music module with playlist management for ADOBE AIR based application.
For this I have searched and found a source to use Datagrid and Checkbox components which overrides some inbuild methods to give the required result..
But Finally I ended with one strange issue
When the check box is placed in the datagrid at 0 column index it works firne but if we place at any index ( I need it to be last colum ) the checkbox is not updating the display.
Source Flex Air project attached.
From the sample... While clicking on a row the left column checkbox is getting updated but Right remains same... when you scroll the Datagrid then the checkboxes are getting update when they are redrawn. I didn't found where to call the redraw for the right checkbox column.
Cany any one faced this strange issue. and found any solution ?????
If the Logic what I am following for a Playlist module is not good one then suggest if you guys know any other mechanism to develop a playlist management with datagrid and Checkboxes.
Message was edited by: ChintuBabu

Hi There
Recently I faced a  requirement to have a checkbox inside a datagrid where I need to develop a music module with playlist management for ADOBE AIR based application.
For this I have searched and found a source to use Datagrid and Checkbox components which overrides some inbuild methods to give the required result..
But Finally I ended with one strange issue
When the check box is placed in the datagrid at 0 column index it works firne but if we place at any index ( I need it to be last colum ) the checkbox is not updating the display.
Source Flex Air project attached.
From the sample... While clicking on a row the left column checkbox is getting updated but Right remains same... when you scroll the Datagrid then the checkboxes are getting update when they are redrawn. I didn't found where to call the redraw for the right checkbox column.
Cany any one faced this strange issue. and found any solution ?????
If the Logic what I am following for a Playlist module is not good one then suggest if you guys know any other mechanism to develop a playlist management with datagrid and Checkboxes.
Message was edited by: ChintuBabu

Similar Messages

  • Item renderer issue

    Hi,
    I have a comboBox as item renderer in my datagrid (comboBox item renderer code bellow).
    1. How can I remove the first blank item? My comboBox arrayCollection doesn't have 0 item.
    2. If I come back to the cell that it was already selected with a value from my comboBox, how can I set the selected item of my comboBox to be the same as the previus value? If I leave the comboBox without selection it will be blank as the 0 element.
    Please help.
    Thanks
    Johnny
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
                 labelField="label" dataProvider="{acCombo}" rowCount="20"
                 change="onSelectionChange(event)" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.dataGridClasses.DataGridListData;
                import mx.events.ListEvent;
                import mx.rpc.events.ResultEvent;
                [Bindable]private var acCombo:ArrayCollection = new ArrayCollection ([{id:1, label:"Item 01"},{id:2, label:"Item 02"},{id:3, label:"Item 03"},
                    {id:4, label:"Item 04"},{id:5, label:"Item 05"}]);
                private var _ownerData:Object;
                public function init():void
                    //init code
                override public function set data(value:Object):void
                    if (value){
                        _ownerData = value as Object;
                        var col:DataGridListData = DataGridListData(listData);
                        var item:Object = new Object;
                        var clabel:String = value[col.dataField];
                        var cid:int = value.id;
                        item.label = clabel;
                        item.id = cid;
                        selectedItem = item;
                override public function get data():Object
                    return _ownerData;
                override public function setFocus():void
                    super.setFocus();
                    open();
                private function onSelectionChange(e:ListEvent):void
                    if(selectedItem && _ownerData){
                        var col:DataGridListData = DataGridListData(listData);
                        var clabel:String = selectedItem.label;
                        var cid:int = selectedItem.id;
                        _ownerData[col.dataField] = clabel;
                        _ownerData[id] = cid;
            ]]>
        </mx:Script>
    </mx:ComboBox>

    Hi,
    I created a sample, maybe someone can see the issue for me
    Thanks!
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" viewSourceURL="srcview/index.html"
                    creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.events.CollectionEvent;
                import mx.events.DataGridEvent;
                import com.myItemEditor;
                import mx.collections.ArrayCollection;
                [Bindable] private var acExecution:ArrayCollection = new ArrayCollection([
                    {Territory:"Arizona", Territory_Rep:"Barbara Jennings", ITEM_ID:1, ITEM_NAME:"Item 01"},
                    {Territory:"Central California", Territory_Rep:"Joe Smith", ITEM_ID:2, ITEM_NAME:"Item 02"},
                    {Territory:"Nevada", Territory_Rep:"Bethany Pittman", ITEM_ID:2, ITEM_NAME:"Item 02"}, 
                    {Territory:"Northern California", Territory_Rep:"T.R. Smith", ITEM_ID:1, ITEM_NAME:"Item 01"},
                    {Territory:"Southern California", Territory_Rep:"Jane Grove", ITEM_ID:3, ITEM_NAME:"Item 03"}
                private function init():void
                private function onItemEditEnd(e:DataGridEvent):void
                    var cEditor:myItemEditor = dgCustomEditor.itemEditorInstance as myItemEditor;
                    var item:Object = cEditor.selectedItem;
                    acExecution.refresh();
            ]]>
        </mx:Script>
        <mx:DataGrid id="dgCustomEditor" dataProvider="{acExecution}" height="160"
                     editable="true" itemEditEnd="onItemEditEnd(event)">
            <mx:columns>
                <mx:DataGridColumn headerText="Territory" dataField="Territory" width="60"
                                   editable="false"/>
                <mx:DataGridColumn headerText="Territory Rep" dataField="Territory_Rep" width="60"
                                   editable="false"/>
                <mx:DataGridColumn headerText="Item ID" dataField="ITEM_ID" width="60"
                                   editable="false"/>
                <mx:DataGridColumn headerText="Item Name" dataField="ITEM_NAME" width="160" itemEditor="com.myItemEditor" />
            </mx:columns>
        </mx:DataGrid>
    </mx:Application>
    Item Editor component
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
                 labelField="LABEL" dataProvider="{acCombo}" rowCount="20"
                 change="onSelectionChange(event)" creationComplete="init()">
        <mx:Script>
            <![CDATA[
                import mx.events.ListEvent;
                import mx.controls.dataGridClasses.DataGridListData;
                import mx.rpc.events.ResultEvent;
                import mx.collections.ArrayCollection;
                [Bindable]private var acCombo:ArrayCollection = new ArrayCollection ([{ID:1, LABEL:"Item 01"},{ID:2, LABEL:"Item 02"},{ID:3, LABEL:"Item 03"},
                    {ID:4, LABEL:"Item 04"},{ID:5, LABEL:"Item 05"}]);
                private var _ownerData:Object;
                private function init():void
                    //init code
                override public function set data(value:Object):void
                    if (value){
                        _ownerData = value as Object;
                        var col:DataGridListData = DataGridListData(listData);
                        var item:Object = new Object;
                        var clabel:String = value[col.dataField];
                        var cid:int = value["ITEM_ID"];
                        item.LABEL = clabel;
                        item.ID = cid;
                        selectedItem = item;
                override public function get data():Object
                    return _ownerData;
                override public function setFocus():void
                    super.setFocus();
                    open();
                private function onSelectionChange(e:ListEvent):void
                    if(selectedItem && _ownerData){
                        var col:DataGridListData = DataGridListData(listData);
                        var clabel:String = selectedItem.LABEL;
                        var cid:int = selectedItem.ID;
                        _ownerData[col.dataField] = clabel;
                        _ownerData["ITEM_ID"] = cid;
            ]]>
        </mx:Script>
    </mx:ComboBox>

  • Accessing S:List Checkbox Item Renderer Outside the Renderer

    Hi All,
    I have an S:List, with a checkbox item renderer.  I was to be able to access the selected portion of the renderer to create a new function that at the press of a button this will delect all the current selected items in the list.
    Doco states that i should be able to do this just by setting the selectedIndex to -1.  But not sure if this is specific to 4.5??  But it is not working for me.
    Below is my current list.  Outside of this list flashbuilder does not know about chkList, or even selected.  How can i get access to this to deslect all?
    <s:List
    id="ltattributes">
    <s:itemRenderer>
    <fx:Component>
    <s:ItemRenderer>
    <fx:Script>
    <![CDATA[
    import mx.events.ItemClickEvent;
    protected function chkList_changeHandler(event:Event):void
    var e:ItemClickEvent = new ItemClickEvent(ItemClickEvent.ITEM_CLICK, true);
    data.selected = event.currentTarget.selected;
    e.item = data;
    e.index = itemIndex;
    dispatchEvent(e);
    ]]>
    </fx:Script>
    <s:CheckBox id="chkList" selected="false" label="{data.displayname}" change="chkList_changeHandler(event)"/>
    </s:ItemRenderer>
    </fx:Component>
    </s:itemRenderer>
    Thanks

    Try: dataGroup.getElementAt(). 
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Problem with checkbox item renderer in datagrid

    I have a data grid having check box as an item renderer. I have viewed many posts in this forum but nothing useful in my case. I am failed to bind my datagrid itemrenderer checkbox with the field of dataprovider i.e. listUnitMovement.CHECK_PATH. Then I have to traverse data provider to check which checkboxes are checked.
    [Bindable]
    var listUnitMovement:XMLList=null;                      
    In a function call
    public function init(event:ResultEvent):void
        listUnitMovement=event.result.unitmovement;
         <mx:DataGrid id="dg_country"
                               dataProvider="{listUnitMovement}"
                                  enabled="true">
                                <mx:columns>
                                   <mx:DataGridColumn>
                                        <mx:itemRenderer>
                                            <mx:Component>
                                                <mx:CheckBox selectedField="CHECK_PATH"  />
                                            </mx:Component>                                       
                                        </mx:itemRenderer>
                                    </mx:DataGridColumn>
                                    <mx:DataGridColumn headerText="Latitude" dataField="NEW_LAT" visible="false"/>
                                    <mx:DataGridColumn headerText="Longitude" dataField="NEW_LONG" visible="false"/>
                                   <mx:DataGridColumn>
                                        <mx:itemRenderer>
                                            <mx:Component>
                                                <mx:Button label="Details"/>
                                            </mx:Component>                                       
                                        </mx:itemRenderer>
                                    </mx:DataGridColumn>
                                </mx:columns>
                            </mx:DataGrid>

    Hi,
    Do you want to just check/uncheck the checkboxes based on the CHECK_PATH field.
    Do you want something like this...
    <?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 listUnitMovement:ArrayCollection = new ArrayCollection([{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:true,NEW_LAT:109.233,NEW_LONG:232.22},{CHECK_PATH:false,NEW_LAT:133.233,NEW_LONG:702.22}]);]]>
    </mx:Script>
     <mx:DataGrid dataProvider="{listUnitMovement}">
     <mx:columns>
     <mx:DataGridColumn>
     <mx:itemRenderer>
     <mx:Component>
     <mx:CheckBox selectedField="CHECK_PATH" change="data.CHECK_PATH=selected" />
     </mx:Component>  
    </mx:itemRenderer>
     </mx:DataGridColumn>
     <mx:DataGridColumn dataField="NEW_LAT"/>
     <mx:DataGridColumn dataField="NEW_LONG"/>
     </mx:columns>
     </mx:DataGrid>
    </mx:Application>
    Please let me know clearly what's your problem...Do you want to just bind the check box based on XmlList or something else..?
    Thanks,
    Bhasker Chari.S

  • DataGrid Horizontal Scroll Problem when datagrid contains Item renderer

    I have datagrid with horizontal scroll policy enabled. Grid
    contains some item renderer also.One of the item renderer is
    datefield when i select a date from the datefield and say the
    adjacent cell of the grid also contain datefield itemrenderer
    and i am selecting date from that itemrenderer also.When i
    scroll horizontally the date in the itemrender changes to any one
    of the two itemrenderer.Some time it works fine.I am getting the
    issue for combobox itemrender also.Can any one help me to solve
    this issue.

    "happybrowndog" <[email protected]> wrote in
    message
    news:ge11ag$jdo$[email protected]..
    >
    quote:
    Originally posted by:
    ravi_bharathii
    > I have datagrid with horizontal scroll policy enabled.
    Grid contains some
    > item
    > renderer also.One of the item renderer is datefield when
    i select a date
    > from
    > the datefield and say the adjacent cell of the grid also
    contain datefield
    > itemrenderer
    > and i am selecting date from that itemrenderer also.When
    i scroll
    > horizontally
    > the date in the itemrender changes to any one of the two
    itemrenderer.Some
    > time
    > it works fine.I am getting the issue for combobox
    itemrender also.Can any
    > one
    > help me to solve this issue.
    >
    > Ravi, I am having a similar problem. I subclass a
    TextInput as an
    > itemrenderer for a column in a datagrid. My subclassed
    TextInput checks
    > to see
    > the value in the overriden set() method, and depending
    on the value, sets
    > the
    > background color of the TextInput to green. When the
    datagrid scrolls
    > horizontally, some unrelated cell colors also change
    green and some of the
    > data
    > gets duplicated in the cells. The underlying data
    provider's data is not
    > confused however. Seems the rendering is screwed up when
    the Datagrid
    > scrolls.
    >
    > Did you find a solution to this problem? I think
    Datagrid is a piece of
    > screwed up code.
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
    Q2

  • Help with datagrid custom item renderer

    Hi ,
    I have a datagrid in which I have a column with a checkbox and a custom Checkbox header renderer and an item renderer.
    When I try to disable the grid the checkbox column does not get disabled?
    Is there any way I can disable the entire grid along with the checkbox column?
    Thanks.

    Override updateDisplayList on the renderer and set the .enabled to match
    owner.enabled.

  • Image in item renderer issue for List Components

    Hello,
    I have an issue when I use an item renderer with an image in
    it. This happens when I do this with a List or TileList component
    that has enough items to create a scroll bar. What happens is the
    images load fine, then I scroll down and the other items and their
    images start appearing, but then the first and last images start
    loading the wrong image. I'll scroll back up and the first item now
    has a different image, and when I scroll back down, the last images
    changes too.
    Has anyone had this problem with image itemrenderers in List
    components?
    Thanks for any help.
    Brade

    The creationComplete event is called ONCE and that's it. But
    each time an itemRenderer is recycled it will have its data
    property reset with new a new record from the dataProvider. Thus
    overriding the set data function lets you inspect the data and do
    what you want with it.
    Data binding in MXML <mx:Image source="{data.image}" />
    is set up by the Flex compiler. When the data property is reset it
    will trigger the data binding notifications. The Flex
    compiler-generated code will intercept that and update the Image
    source property.
    If you use MXML, then use data binding. If you write your
    itemRenderer in ActionScript, override the set data
    function.

  • Checkbox item renderer populated with data from 2 sources

    I have a list object that has a check box and a label (using an inline item renderer).  The list itself is populated with an array of objects and whether the checkbox is selected takes those objects and adds them to another list (for outbound purposes).  Since the selected list can change elsewhere in my app how do I keep the binding of selections consistent?  The dataprovider for my checkbox list is the first array of objects and is binded, but the second one (selected array) is not.  What would be the best way to provide that binding to make sure the selected is consistent when the second array changes.  Some of the code is below to better show...
    <cms:HilightList
         id = "distributorList"
         width = "100%"
         height = "100%"
         drawHighlight="{ViewUtils.drawHighlightIndicator}"
         drawSelection="{ViewUtils.drawHighlightIndicator}"
         dataProvider="{pmDistributors.distributors}">
         <mx:itemRenderer>
              <mx:Component>
                   <mx:HBox>
                        <mx:CheckBox
                                           selected = "{outerDocument.isSelected(data)}"
                               change = "{outerDocument.handleSelectedChange(event)}"/>
                        <mx:Label text="{data.name}"/>
                   </mx:HBox>
              </mx:Component>
         </mx:itemRenderer>
    </cms:HilightList>
    public function isSelected(item:Object):Boolean
         var partner:Partner = item as Partner;
         var selected:Boolean = false;
         for each(var schedPartner:Partner in scheduleAssets.partners)
              if(schedPartner.id == partner.id)
                   selected = true;
         return selected;
    public function handleSelectedChange(event:Event):void
         var partner:Partner = event.currentTarget.parent.data as Partner;
              if(event.currentTarget.selected)
                   addPartnerEvent(partner);
              } else {
                   removePartnerEvent(partner);

    Hi Aakcse,
    In this condition, you need to make use of both the Precedence Constraint between Control Flow Tasks and the Conditional Split Transformation. Supposing you get the value in the flat file and store it in a variable via Script Task, you can create two Data
    Flow Tasks, and connect the Script Task to the two DFTs.
    For the Precedence Constraint between the Script Task and the Data Flow Task 1, set the “Expression and Constraint” expression to @[User::vEntryStatus]=="Y". And for the Precedence Constraint between the Script Task and the Data Flow Task 2, set the “Expression
    and Constraint” expression to @[User::vEntryStatus]=="N".
    In Data Flow Task 1, add a Conditional Split Transformation with this expression [Entry]==”YES”, and direct this output to the destination component. In Data Flow Task 2, also add a Conditional Split Transformation with expression [Entry]==”NO”, and direct
    the output to the destination component.
    Regards,
    Mike Yin
    If you have any feedback on our support, please click here
    Mike Yin
    TechNet Community Support

  • Setting Focus to datagrid next Item renderer column

    Hi
    I am having spark datagrid with 7 colum, I am facing problem to set focus for item renderer element.
    Below is my datagrid, when user enter some text in text input and press TAB key, I want trade button to be in focus. and from trade column Tab key press I want delete button to be in focus.
    I tried giving
    tabEnabled="true" tabChildren="false" tabFocusEnabled="true" editable="true" hasFocusableChildren="true"
    for datagrid.
    Also i tried giving selectedCell
    var _focusedCell:Object = new Object();
                                                                _focusedCell.rowIndex = dgTermDepo.selectedIndex;
                                                                _focusedCell.columnIndex = 5;
                                                                dg.selectedCell = _focusedCell as CellPosition;
    but nothing is working, I know I am missing some logic or property, Please suggest me on this
    Thanks
    Sonu

    You need to dig down into the event object and look at the
    listData.
    public function clickMe(e : MouseEvent ):void {
    var rowIndex : int = e.currentTarget.listData.rowIndex
    var colIndex : int = e.currentTarget.listData.columnIndex
    if the listData object is null when you try this you may need
    to add the following methods as overrides to the renderer or create
    a base renderer and extend all your renderers from the base
    renderer so that you always override these methods.
    [Bindable("dataChange")]
    private var _listData : BaseListData;
    override public function get listData() : BaseListData {
    return _listData;
    override public function set listData( value : BaseListData )
    : void {
    _listData = value;
    }

  • Image item renderer issue

    Hi all,
    Yesterday I found a soultion to display my image in my datagrid column. Now the issue is that if i leave the screen and come back to my screen the images move one space like the row index is adding one count, it's not validating my if statement.
    Any ideas?
    Thanks
    Johnny
    <mx:DataGridColumn headerText="LOCK" dataField="ISLOCKED" width="40">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox horizontalAlign="center">
                <mx:Script>
                    <![CDATA[
                        import mx.core.BitmapAsset;
                        [Embed(source="assets/images/lock.png")]
                        [Bindable]
                        public var lockImage:Class;
                        private function checkLocked():void{
                            if (data.ISLOCKED == 1){
                                var asset:BitmapAsset = new lockImage() as BitmapAsset;
                                img.source = asset;
                                addChild(img);
                            }else{
                                img.source = "";
                                addChild(img);
                    ]]>
                </mx:Script>
                <mx:Image id="img" creationComplete="checkLocked()" />
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>

    Renderers get recycled.  CreationComplete is rarely the event to use.  See
    the item renderers posts on my blog
    Alex Harui
    Flex SDK Team
    Adobe System, Inc.
    http://blogs.adobe.com/aharui

  • DataGrid custom header renderer issues

    I'm trying to create a DataGrid headerRenderer with a
    TextInput to filter the grid from the column. The custom renderer
    simply has a label (with the column header label) and then a text
    input, and it's all in AS, implementing IFactory, etc. It's
    rendering just fine.
    The issue is with the filtering - at first, I tried just
    adding the text box, but as soon as I typed anything in it, the
    filtering logic (which must call dataProvider.refresh() to refresh
    the dataGrid) caused the header to be re-instantiated, thereby
    clearing the filter text input field. I later worked around this by
    caching the TextInput objects elsewhere, and having the header
    simply addChild on them.
    However, the issue still gets in the way. The headerRenderer
    is reinstantiated twice per call to refresh(), causing it to blink,
    and if the user types too fast, it throws a RTE because the
    components haven't been instantiated yet.
    Is there a way to stop this incessant re-initialization of
    the headerRenderer? It doesn't seem necessary or efficient. If
    anyone knows or wants to help I would be very grateful.
    Thanks!

    This may be caused by the TextInput event you are using to
    call the filtering method. Are you call your filtering method from
    the TextInput's change event, perhaps? If so, each character being
    typed will call the filter method. Call your filtering method from
    the valueCommit event, and see if that helps.
    Put a break on the first line of your filter method, debug
    the app, start typing into the TextInput and watch what happens. If
    the filter method is called multiple times this could be the
    problem.
    Be sure you don't call the filter method until the typing is
    completed.

  • Custom Item Renderer Issue for List

    Hi,
    I have a List that uses a custom renderer that contains a
    combo box and a checkbox.
    If i define the data provider inline in MXML both the
    combobox and the checkbox render values correctly.
    However, if I switch the dataprovider to an AS 3.0
    ArrayCollection using same name/value pairs, the checkbox renders
    properly but the combo box doesn't show text values. What is weird
    is that if I trace the data, the value is accessible but it won't
    show in combo.text of control.
    Any ideas?

    The creationComplete event is called ONCE and that's it. But
    each time an itemRenderer is recycled it will have its data
    property reset with new a new record from the dataProvider. Thus
    overriding the set data function lets you inspect the data and do
    what you want with it.
    Data binding in MXML <mx:Image source="{data.image}" />
    is set up by the Flex compiler. When the data property is reset it
    will trigger the data binding notifications. The Flex
    compiler-generated code will intercept that and update the Image
    source property.
    If you use MXML, then use data binding. If you write your
    itemRenderer in ActionScript, override the set data
    function.

  • CheckBox Item Renderer checks wrong grid row after sorting

    I have an advanced Data Grid that has a checkBox ItemRenderer. The underlying object being displayed (Server) in the dataGrid is being bound to the checkBox with a selectedForDeployment:Boolean property.
    I had this working just fine until the datagrid is sorted. After the grid is sorted I can click on the checkBox in row 2 and the checkBox in row 8 will be selected for instance. Or in some cases all checkBoxes will become checked. Also, if I have some already checked and then sort, the checkBox will become unchecked.
    I have an example of my itemRender below. Any idea on how I can get this to work:
    public class CheckBoxRenderer extends CheckBox
            override public function set data(value:Object):void {
                if(value){
                    super.data = value;
                    Server(super.data).addEventListener("setSelectionChanged", valueChange);
                    this.selected = value.selectedForDeployment;
            public function CheckBoxRenderer(){
                focusEnabled = false;
                BindingUtils.bindSetter(selectionChange, this, "selected");
            //this method occurs the checkbox is clicked
            public function selectionChange(value:Boolean):void{
                trace(value);
                this.selected = value;
                if(this.data){
                    this.data.selectedForDeployment = value;
            //This method occurs when the selectedForDeployment boolean in the object changes
            public function valueChange(event:Event):void{
                this.selected = event.target.selectedForDeployment;
            /* center the checkbox if we're in a datagrid */
            override protected function updateDisplayList(w:Number, h:Number):void
                super.updateDisplayList(w, h);
                if (listData is DataGridListData)
                    var n:int = numChildren;
                    for (var i:int = 0; i < n; i++)
                        var c:DisplayObject = getChildAt(i);
                        if (!(c is TextField))
                            c.x = (w - c.width) / 2;
                            c.y = (h - c.height) / 2;

    This usually works for me:
    package renderers
        import flash.events.Event;   
        import mx.controls.CheckBox;
        public class CheckBoxRenderer extends CheckBox
            public function CheckBoxRenderer()
                super();
                addEventListener(Event.CHANGE, handleChange);
            override public function set data(value:Object):void {
                if(value){
                    super.data = value;
                    selected = value.selectedForDeployment;
            private function handleChange(event:Event):void{
                data.selectedForDeployment = event.target.selected;

  • Regarding Item renderer issue in Grid

    Hi All,
    We are using custom MXML based itemrender in Grid when drag and drop property has been enabled "Null object reference error is raised from Itemrender" during drap/drop event.Please give a solution on this issue.
    regards,
    karthik

    Hi Karthik
             to where u are dragging this record from grid...? the second component also ready to accept the same type of records when u drag form grid to second component.. that is the scenario..

  • Datagrid colum item renderer HELP!!!!!

    Hi,
    I have the below datagrid, and I have to populate one of the column with three different images, a cricle an squeare and a triangle. I've been sucessful adding dinamically the differents itemrenderers. For the triangle one it has been a really pain in the *** tying to draw the triangle, but finally i figured it out, and I can draw it, but I cant set the result triangle in the middle of the column, I dont know if it's a Sprite. But I've tried with a button and it sets in th emiddle of the column, so it has to be because the sprite or something i'm doing work in some of the classes. Please HELP!!! I really appreciate your help and advice I'm newbie at Flex.
    Thanks in advance!!!
    <s:HGroup y="200" left="22" right="22">
         <s:Group width="100%">
              <mx:DataGrid id="dgDatosMapa" width="357" height="108" visible="true" dataProvider="{arrDatos}" rowHeight="40">
                   <mx:columns>
                   <mx:DataGridColumn headerText="Símbolo" dataField="simbolo" textAlign="center" width="80" />
                   <mx:DataGridColumn headerText="Tamaño" dataField="size" textAlign="center" visible="false" />
                   <mx:DataGridColumn headerText="Intervalo" dataField="intervalo" textAlign="center" width="80"/>
                   <mx:DataGridColumn headerText="Rótulo" dataField="rotulo" textAlign="center" width="80"/>
                   </mx:columns>
              </mx:DataGrid>
         </s:Group>
    </s:HGroup>
    var col:DataGridColumn = dgDatosMapa.columns[0];
    col.itemRenderer = new ClassFactory(triangle);
    package widgets
    import flash.accessibility.AccessibilityProperties;
    import flash.display.DisplayObject;
    import flash.display.DisplayObjectContainer;
    import flash.display.Graphics;
    import flash.display.LoaderInfo;
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.Event;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.geom.Transform;
    import mx.containers.Canvas;
    import mx.containers.HBox;
    import mx.controls.List;
    import mx.controls.listClasses.IListItemRenderer;
    import mx.controls.listClasses.ListItemRenderer;
    import mx.core.UIComponent;
    import mx.managers.ISystemManager;
    import spark.components.Group;
    import spark.primitives.Graphic;
    import spark.primitives.Line;
    import widgets.CustomImportLayers.ImportLayers;
    public class triangle  extends UIComponent implements IListItemRenderer
    private var _objData:Object;
    private var sprite:Sprite;
    public function triangle()
    super();
    height=20;
    width=16; 
    override protected function createChildren():void
    super.createChildren();
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
    super.updateDisplayList(unscaledWidth,unscaledHeight);
    public function drawTriangle(datos:Object):void
    _objData = datos;
    sprite = new Sprite();
    var triangleHeight:int = (_objData.size/4);
    var uic:UIComponent = new UIComponent();
    sprite.graphics.lineStyle(1,int(0x000000),1);
    sprite.graphics.beginFill(_objData.simbolo);
    sprite.graphics.moveTo((triangleHeight/2)+2, 3);
    sprite.graphics.lineTo(triangleHeight+2, (triangleHeight+1));
    sprite.graphics.lineTo(2, triangleHeight+1);
    sprite.graphics.lineTo((triangleHeight/2)+2, 3);
    sprite.graphics.endFill();
    uic.addChild(sprite);
    this.addChild(uic);
    override protected function commitProperties() : void
    super.commitProperties();
    public function set data(value:Object):void
    _objData = value;
    public function get data():Object
    return _objData;
    package widgets
    import mx.containers.HBox;
    import mx.containers.VBox;
    import mx.controls.Button;
    import spark.components.Group;
    import widgets.GenMapasTematicos.triangle;
    public class tri  extends HBox
    private var trian:triangle;
    private var _objData:Object;
    public function tri()
    super();
    this.width=80;
    this.setStyle("horizontalAlign", "center");
    this.setStyle("verticalAlign", "top");
    override protected function createChildren():void
    var b:Group = new Group();
    b.percentWidth=100;
    this.addChild(b);
    trian = new triangle();
    b.addElement(trian);
    override protected function commitProperties() : void
    super.commitProperties();
    trian.drawTriangle(_objData);
    override public function set data(value:Object):void
    _objData = value;
    super.invalidateDisplayList();
    override public function get data():Object
    return _objData;

    Here is my Scenario, in my datagrid the second column of the first row (987.93) background color depends upon some condtion. The remaning rows of column B depends upon the column C . If "the column C is OK" it will be green , "NOT OK" red. But the first row's second column color depends upon some other condition. How can i achieve this ?

Maybe you are looking for

  • Mail & iChat gone all white & dead

    Something really strange just happened: The Mail Appl. window went all white, I just see the folders on the left, but all mails are invisible. I checked the option "show mailboxes" under View, but that one was activated. The folders ell me that mails

  • Keyboard fail macbook pro

    Some of tagents at the built-in keyboard at my MacBook Pro doesn´t react anylonger as they should. These are som of the tagents at left, f i the shift-tangent that makes BIG letters. What to do?

  • Dump SAPSQL_ARRAY_INSERT_DUPREC when loading a hierarchy

    Hi Guru's, I have an error when i try to load a hiearchy on my BI system. I want to load the Cust_sales hierarchy but i ahev a short dump : SAPSQL_ARRAY_INSERT_DUPREC Any idea ? Cyril

  • Facebook is unable to download on new ipad air

    Just turned on my new ipad air and set it up. Try to install facebook app but I get the error "Unable to download app. Facebook could not be downloaded at this time" I have deleted it, restarted ipad, tried to reinstall, doesn't work. Tried resetting

  • Assigning javascript variables to java variables in JSP

    Does anyone know if it possible to assign a javascript value to a java variable in a javascript function? I want to be able to use the javascript value in a PreparedStatement call, but I can't assign the value of the javascript variable to a java var