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;
}

Similar Messages

  • Setting focus to a menu item in New Form Instance...

    Dear All,
    Please let me know how to set focus to a menu item in New Form Instance trigger,
    so that as the user opens the form control should be with the menu item and not with the First item of Data Block.

    To my knowledge you cannot set input focus to a menu item.
    Alternatively you could create a push button and put input focus there.
    hth
    Hans

  • 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.

  • 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 ?

  • 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

  • Datagrid and Inline Item renderer problem

    I have a datgrid with two inline item renderers. The dataprovider for my DG is a nested object (objects within objects within objects i.e 3-layered).
    Main Object - 1st Level
                              |
                  2nd Level Object 1
                                    |
                                3rd level object '1' => ('name'=>somename,'id'=>someid)
                                3rd level object '2'
                                3rd level object 'n'
                 2nd Level Object 2
                                    |
                                3rd level object '1' => ('name'=>somename,'id'=>someid)
                                3rd level object '2'
                                3rd level object 'n'
    I use 2 item renderers (one for each datagrid column) which loops thro the 2nd level object1 and 2 respectively (the 2nd level object is a dynamic array of objects, in that the number of objects within keep changing).
    Within the item renderer I loop thro the 2nd level object using a foreach and then display the data. The data is a linkbutton, which when clicked , calls a remote object function to delete the data from the database
    now on the result event of the remote object function call, i call the function to repopulate the DG, so that the updated data is displayed.
    When i click on the linkbutton in the first row, the backend works perfectly fine (the data gets deleted from the database and the refreshed data is sent back), but for some reason, the deleted data suddenly appears in the 2nd row.
    When i delete it from the second row, it appears on the 3rd row (nothing happens in the backend since the data is already deleted).. and so on, till it appears on the last row and then the DG looks exactly the way it shld have looked after the first delete.
    This is just the beginning. The second item renderer also displays a linkbutton, which when clicked, displays that data in the previous column (the one where this data can be deleted). When i click on 1st row, the data gets added in the previous column of the second row .. and so on..
    Basically, my DG is acting really weird. I overrided the set data function in the item renderer to refrsh the data and called its invalidateDisplayList. I also call the Datagrid's invalidateDisplayList function after each refresh.  The behavior remains the same.
    Please help me on this ...

    Hi, Post a test code.... It will be a lot easier to help you Mich

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

  • Multi-Use Item Renderer for DataGrid Column

    I have a dataGrid where the first column of the grid displays
    an icon for the 'type' of item in the row. I created a custom
    itemRenderer component which I reference in its own namespace, and
    everything works great. Since this is a pretty common concept, I'd
    thought that I'd be able to re-use that itemRenderer throughout the
    application, but everytime I try to call the itemRenderer in
    another dataGrid, I get 2 errors saying "the inlineComponent could
    not be found" and then because of that "Access of undefined
    property".
    It doesn't make sense for an itemRenderer to be only good for
    one use, so I'm obviously missing some fundamental issue. Can
    someone enlighten me?

    Hah, found it. It is an mxml example, and implements
    IDropInListItemRenderer. It for an image renderer, but you will be
    able to see what to do.
    Tracy
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    horizontalAlign="center" verticalAlign="middle"
    width="16" height="16"
    implements="mx.controls.listClasses.IDropInListItemRenderer"
    >
    <mx:Script><![CDATA[
    import mx.controls.listClasses.IDropInListItemRenderer;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.DataGrid;
    [Bindable]
    private var source:String;
    private var _listData:BaseListData;
    public function get listData():BaseListData
    return _listData;
    public function set listData(value:BaseListData):void
    _listData = value;
    invalidateProperties();
    override protected function commitProperties():void
    super.commitProperties();
    if (_listData is DataGridListData)
    var dgld:DataGridListData = _listData as DataGridListData;
    source =
    data[DataGrid(dgld.owner).columns[dgld.columnIndex].dataField];
    ]]></mx:Script>
    <mx:Image source="{source}"/>
    </mx:VBox>

  • How to dispatch custom events from an item renderer used for Datagrid Column

    Hi,
    I am using an Item Renderer for a Data Grid Column and in that mxml, I am dispatching a custom event with data.
    But the main mxml which has the DataGrid is not able to resolve the event. How can I solve this?
    Thanks

    Hi,
    This is the constructor for Event.
    public function Event(type:String, bubbles:Boolean  = false, cancelable:Boolean  = false)
    When you created your custom event after extending from Event, for the parent container receives the event, the bubbles property must be set to true.
    Please check if you have done so. That should solve the problem. Let me know if it doesn't.
    Nishad

  • Two item renderer for one datagrid column?

    hi
    i have one doubt
    can we use two item renderer for one datagrid column
    any possibilities
    why i am asking this because
    during drag and drop i need one itemrenderer and during application initialization i need another itemrenderer
    any possibilities
    karthik.k

    Hi,
    I think your requirement can be completed by using ViewStack you can pass selected index to it according to requirement.
    See:
    <itemRenederer ...
         <viewstack selectedIndex = 0 ...>
              <vBox id="vBox1" >
                        Your 1st itemrenderer will come here....
              </vBox>
              <vBox id="vBox2" >
                        Your 2nd itemrenderer will come here....
              </vBox>
         </viewStack>
    </itemRenederer>
    You have to just toggle selectedIndex.
    Thanks

  • How to overlap datagrid colums line with item renderer

    Hello guys I been stuck for a few days now and I'm wondering if there is a better way to do this.
    I put an item renderer on a column of the datagrid. The renderer basically expands the column height and shows some controls.
    Im using a border container as the container that is holding the items in the grid. However what I would like to do is make the border container as big as the grid with a plus sign button. and then basically hide that  rows vertical grid lines.
    i tried setting the depth eventhought i understant this is not a spark grid i though it should work but it does not. Any tip or direction would be greatly appreciated.
    Miguel

    ok i answered my own question. what i need to do is use the advance datagrid. Then set these properties.
    <mx:AdvancedDataGrid defaultLeafIcon="{null}"
                             folderClosedIcon="{null}"
                             folderOpenIcon="{null}"
                             disclosureClosedIcon="@Embed(source='assets/plusSign.png')"
                             disclosureOpenIcon="@Embed(source='assets/plusSign.png')">
    Message was edited by: miguel8312

  • Need for a Datagrid with variableRowHeight="true" and custom Item Renderer to display exact rows

    Hi again, developers:
    I'm in a search of a datagrid  with certain characteristics:
         - variableRowHeight = "true"
         - only one column
         - each row must have a custom item renderer with possibly different heights, and a fixed width
         - the datagrid must show always every item in the data provider with no vertical scroll bars, what means that the datagrid height must have always the exact height sum of all the item renderers it is displaying.
         - and no extra empty rows must appear in the last positions of the datagrid
    The last two requirements are something difficult to achieve... for some reason, empty rows appear at the last positions of the datagrid. I post what i've managed to get:
    <mx:Script>
         <![CDATA[
         private function resize():void
                    if (dg.dataProvider)
                        var h:Number = dg.measureHeightOfItems( -1, dg.dataProvider.length);
                        dg.height = h;
         ]]>
    </mx:Script>
    <mx:DataGrid id="dg" width="530" horizontalCenter="0" verticalScrollPolicy="off"
            dataProvider="{dp}"
            wordWrap="true" variableRowHeight="true" showHeaders="false" dataChange="resize()" height="{dg.measureHeightOfItems(-1,dg.dataProvider.length)}" click="Alert.show(dg.rowCount.toString());">
            <mx:columns>
                <mx:DataGridColumn headerText="ID" width="50">
                    <mx:itemRenderer>
                        <mx:Component>
                            <mx:TextArea height="{Math.random()*100}" wordWrap="true" backgroundColor="{Math.random() * 16777216}" paddingTop="0" paddingBottom="0"/>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
        </mx:DataGrid>

    Thanks Harui, but it doesn't help. If the border is set it will help, but the very big problem is the empty rows that appear at the end of the datagrid... I can't find a way of measuring correctly the height of the itemRenderers!
    I'll update this thread if I manage to do it.

  • DataGrid Using an item renderer that spans an entire row

    Anyone know how can I do this using DataGrid?

    I dont understand how Can I do it. Below I have a source code that I'm working with this case. I have 2 columns and I would like when i click in combobox my item renderer fill all rows.
    Look I have this code (Main Application and Renderer):
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo">
         <mx:transitions>
              <mx:Transition fromState="*" toState="*">
                   <mx:Resize target="{this}"/>
              </mx:Transition>
         </mx:transitions>
         <mx:states>
              <mx:State name="normal"/>
              <mx:State name="expanded"/>
         </mx:states>
         <fx:Script>
         <![CDATA[
              import mx.collections.ArrayCollection;
              [Bindable]
              public var ac:ArrayCollection;
              private function changeState(event:Event) : void {
                   if( event.target.selected )
                        currentState = "expanded";
                   else
                        currentState = "normal";
              override public function set data(value:Object) : void {
                   super.data = value;
                   ac = new ArrayCollection(value.models);
         ]]>
         </fx:Script>
         <mx:CheckBox label="{data.title}" click="changeState(event)"/>
         <mx:List dataProvider="{ac}" y="20" width="100%" includeIn="expanded"/>
    </mx:Canvas>
    <s:Application
         xmlns:fx="http://ns.adobe.com/mxml/2009"   
         xmlns:mx="library://ns.adobe.com/flex/halo"    
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:ct="*"
         height="100%" width="100%">
         <fx:Script>
         <![CDATA[
              import mx.collections.ArrayCollection;
              [Bindable]
              public var dp:ArrayCollection = new ArrayCollection([
              {title:"Ford", style: 'Modern', models:["Fusion","Taurus","Mustang"]},
                   {title:"Volkswagen",  style: 'Normal', models:["Passat","Jetta","Beetle", "Golf", "GTI"]},
                   {title:"Infiniti", style: 'Modern', models:["FX35","GX35","Q45","M35"]},
                   {title:"Audi",  style: 'Esport', models:["A3","A4","A6"]}
         ]]>
         </fx:Script>   
         <mx:DataGrid dataProvider="{dp}" variableRowHeight="true" height="100%" width="100%">
              <mx:columns>
                   <mx:DataGridColumn dataField="title" headerText="title" itemRenderer="DetailItem"/>
                   <mx:DataGridColumn dataField="style" headerText="style" />
              </mx:columns>
         </mx:DataGrid>
    </s:Application>

  • Item Renderer in a Datagrid

    I'm struggling with how to make a check mark ( image ) show
    up or not based on the value of some data in each datagrid line
    item. I'm using an item renderer but I'm missing something. Any
    help would be greatly appreciated.
    thanks,
    STeveR

    The following is my entire itemrenderer...please excuse any
    bad style as this is a WIProgress..
    Its probably easier to quote the adobe docs on listdata...If
    a component implements the IDropInListItemRenderer interface, you
    can use its listData property to obtain information about the data
    passed to the component when you use the component in an item
    renderer or item editor..I made sure the component implements the
    interface as you can see in the code at the top of component. Then
    add the couple of required functions regarding listdata, then you
    can access the listdata in your own functions in the renderer, like
    i do in set data function.
    this.BTN_***_mark.label =
    value[DataGridListData(listData).dataField];
    this line assigns the value from my datagrid to the renderers
    button label. (this renderer is a button that the user can press)
    so i want the buttons label to show the value coming in from the
    datagrid. So listdata is just a way to
    explicitly get the column name where the current data is
    being sourced from in your datagrid.As the grid is being rendered,
    it renders row by row. In each row it goes thru your columns . SO
    initially it for row 1 it would begin rendering firstname, surname,
    mark, average...etc etc. If i put an alert in on
    value[DataGridListData(listData).dataField
    I would see these column names popping up as they are getting
    rendered in the DGrid.
    Hope this helps...
    <!-- <?xml version="1.0" encoding="utf-8"?>-->
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()" width="74" height="30"
    horizontalAlign="center" verticalAlign="middle"
    implements="mx.core.IFactory,mx.controls.listClasses.IDropInListItemRenderer">
    <mx:Metadata>
    </mx:Metadata>
    <mx:Script>
    <![CDATA[
    import mx.managers.PopUpManager;
    import mx.controls.DataGrid;
    import mx.utils.ArrayUtil;
    import mx.collections.ArrayCollection;
    import mx.collections.IViewCursor;
    import mx.controls.Alert;
    import mx.events.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.containers.TitleWindow;
    private var panel:AssessmentMarkPopup = new
    AssessmentMarkPopup();
    var the_val = 0;
    var col_index:int;
    private var _listData:BaseListData;
    public function get listData() : BaseListData
    return _listData;
    public function set listData( value:BaseListData ) : void
    _listData = value;
    private function showLoginForm():void {
    var pop:AssessmentMarkPopup =
    AssessmentMarkPopup(PopUpManager.createPopUp(this,AssessmentMarkPopup,true));
    pop.addEventListener("closepopup",onClose);
    pop.TXT_***_mark.text = this.BTN_***_mark.label;
    var row:int =
    this.parentApplication.DG_class_students.selectedIndex;
    pop.student_name =
    this.parentApplication.DG_class_students.selectedItem.firstname + "
    " + this.parentApplication.DG_class_students.selectedItem.lastname;
    private function onClose(e:MyClosePopupEvent):void{
    this.BTN_***_mark.label = e.data.mark;
    public function newInstance():*
    return new MarkEntry();
    public override function get data():Object
    return super.data;
    override public function set data(value:Object):void {
    var dg:DataGrid = (listData) ? DataGrid(listData.owner) :
    null;
    var column:DataGridColumn = (dg) ?
    dg.columns[listData.columnIndex] as DataGridColumn : null;
    col_index = listData.columnIndex;
    var str:String = String(column.dataField);
    this.BTN_***_mark.label =
    value[DataGridListData(listData).dataField];
    ]]>
    </mx:Script>
    <mx:Button click="showLoginForm()" id="BTN_***_mark"
    width="52"/>
    </mx:VBox>

Maybe you are looking for

  • An unexpected error occurred. Error# 16828 - Air Update

    I am trying to create an update system of my Air program. The first application (release) is created in EXE (native installer). The new version is made to a Air file (AIR package). I get an error in the and of installation - An unexpected error occur

  • Manually transport BP to ERP

    Hi What is the T.Code for sending BP's manually, if queues fail? and what is the process? how to do it? Reward with Full Points, minimum info is OK. Message was edited by:         CRMUSER77

  • How to remove all instance in a repeatable subform (bis)

    Hi Niall, A few years ago, you helped a user who asked "How to remove all instance in a repeatable subform". Please could you do again with approximately the same problem ? In a click event, I have the script "_CarteEN.addInstance();". Well ! Many ca

  • How do you export a timeline fade as a gif?

    Dear Photoshop, I'm working in CS6 and have created a multi-image file in the video timeline that includes the fade function. This allows the images to transistion smoothly from one image to the next. When I play the video in Photoshop the transistio

  • Fixing or uninstalling Photoshop CS5 Extended 12.LS4 32-64 bit suite

    HI There is a utility to fix all the permissions of files and registry keys of Photoshop CS5 Extended 12.LS4 32-64 bit suite installed on Windows 7 Ultimate 64-bit or uninstall it completely and correctly? THANKS BYE