ItemRenderer Bug?

I have been struggling with this issue for about 2 weeks. I
was able to reproduce it in a small example. I add and remove an
itemRenderer to a datagrid column at run-time. This only won't
cause the RTE but I also set the datagrids dataProvider again which
causes the error. You will need the Flash Player Debug version to
actually see the error. You can view the example application
here. I
have also include the source with this post.
--- App.mxml ---
<?xml version="1.0"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.collections.*;
public var renderer:ClassFactory;
public function initApp():void
loadData(10);
public function loadData(rows:uint):void
var gridData:ArrayCollection = new ArrayCollection();
for( var x:int = 0; x < rows; x++)
var vo:Object = new Object();
vo.fname = "John" ;
vo.lname = "Doe";
vo.job = "Programmer";
gridData.addItem(vo);
dg.dataProvider = gridData;
public function withRenderer():void
renderer = new ClassFactory(LinkRenderer);
fname.itemRenderer = renderer;
loadData(50);
public function withOutRenderer():void
fname.itemRenderer = null;
loadData(100);
]]>
</mx:Script>
<mx:TextArea text="To reproduce bug click 'With Item
Renderer' and then scroll datagrid!" width="300"/>
<mx:HBox>
<mx:Button id="wBtn" click="withRenderer()" label="With
Item Renderer"/>
<mx:Button id="woBtn" click="withOutRenderer()"
label="WithOut Item Renderer"/>
</mx:HBox>
<mx:DataGrid id="dg" width="300" height="400">
<mx:columns>
<mx:DataGridColumn id="fname" dataField="fname"
headerText="Firstname" />
<mx:DataGridColumn id="lname" dataField="lname"
headerText="Lastname" />
<mx:DataGridColumn id="job" dataField="job"
headerText="Job Description" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
--- LinkRenderer.mxml --
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="100%" height="100%" horizontalAlign="left">
<mx:Script>
<![CDATA[
]]>
</mx:Script>
<mx:LinkButton id="linkBtn" label="John"/>
</mx:HBox>

I have not gotten any feedback on this issue. I did submit
the bug to Adobe and I just blogged it
gurufaction.blogspot.com
. I thought I had a workaround but the problem is back. I hope I
can resolve this soon.

Similar Messages

  • Suggested workaround for list itemrenderer bug?

    Can someone point me in the right direction for a workaround for the problem described as Flex bug 28191:
    https://bugs.adobe.com/jira/browse/SDK-28191
    Steps to reproduce:
    1. Populate a Tree/List with data and provide a custom itemRenderer class factory.
    2. Change the class factory and dataProvider at the same time.
    3. List.createItemRenderer() will crash during since Factory is the key and it has been changed.
                    delete freeItemRenderersByFactory[factory][renderer];
    Actual Results:
    Crash because the renderer can not be found since it does not exist on that factory dictionary since the class factory was changed and the lookup is using the new factory.
    Expected Results:
    Not crash.
    Seems like a race condition, as sometimes during this process it skips that block of code but in other cases it falls into this block and fails.
    I need to change the data provider and item renderer of a tree control at runtime. Is there one or more methods I should run to prevent this? As the bug notes state, this is an intermittent problem. The error occurs here:
    if (factory == itemRenderer)
                if (freeItemRenderers && freeItemRenderers.length)
                    renderer = freeItemRenderers.pop();
                    delete freeItemRenderersByFactory[factory][renderer];

    Thanks. Actually, I have been updating (not setting or changing) the tree's dataprovider, and then changing the classFactory like this:
    processesXML = event.result as XML;
    nodeTreeData.source = processesXML.children();
    if (treeMultiSelect)
    nodeTree.itemRenderer=new ClassFactory(renderers.TreeItemRendererV1);
    nodeTree.allowMultipleSelection = true;
    nodeTree.setStyle("selectionColor", "0xFFFFFF");
    nodeTree.setStyle("disclosureOpenIcon", MinusIcon);
    nodeTree.setStyle("disclosureClosedIcon", PlusIcon);
    else
    nodeTree.itemRenderer=new ClassFactory(mx.controls.treeClasses.TreeItemRenderer);
    nodeTree.allowMultipleSelection = false;
    nodeTree.setStyle("selectionColor", "0x7FCEFF");
    nodeTree.setStyle("disclosureOpenIcon", OpenArrowIcon);
    nodeTree.setStyle("disclosureClosedIcon", ClosedArrowIcon);
    I had tried using validateNow after changing the ClassFactory before but did get the error again. I will try it again but update the data provider after. Since it's an intermittent error I'm finding it hard to know if a fix is really working.

  • Custom itemRenderer - Bug?

    Hi, I have an example of some code that I can't figure out.
    What I'm doing may not be the best way to do what I want, but I
    believe is should work, and can't figure out why it doesn't. I have
    a datagrid with two columns, and the second column uses a custom
    itemRenderer to draw multiple circles depending on nested XML data
    for that row. In the
    set data function of my itemRenderer, I'm trying to get the
    width of the column, and use that to calculate where to put my
    circle, as a value of 1 to 10.
    - The first time, the
    set data is called four times where there are three rows
    - The first time it's called, this.width is zero
    - When resizing column widths, set data is called again - the
    first time only for the 2nd and 3rd rows, but with the correct
    width
    - Subsequent times it's called for all three rows, but the
    first row uses the LAST width, not the new width
    Any ideas? Here's my code:
    Project name is FlexSample, first file is FlexSample.mxml,
    then other two files are MyComponents/MyItemRenderer.as and
    MyComponents/PointComponent.as
    FlexSample.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*"
    width="100%" height="100%"
    initialize="init()" horizontalGap="0" verticalGap="0" >
    <mx:Script>
    <![CDATA[
    import mx.events.ResizeEvent;
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.http.HTTPService;
    import mx.events.*;
    [Bindable]
    public var myXML:XML=
    <ROWSET>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90686</POINT_ID>
    <X_VALUE>2</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90806</POINT_ID>
    <X_VALUE>8</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 2 and 8</NOTE_TX>
    </ROW>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90111</POINT_ID>
    <X_VALUE>4</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90222</POINT_ID>
    <X_VALUE>6</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 4 and 6</NOTE_TX>
    </ROW>
    <ROW>
    <POINTS>
    <POINT>
    <POINT_ID>90333</POINT_ID>
    <X_VALUE>1</X_VALUE>
    </POINT>
    <POINT>
    <POINT_ID>90444</POINT_ID>
    <X_VALUE>10</X_VALUE>
    </POINT>
    </POINTS>
    <NOTE_TX>Points are 1 and 10</NOTE_TX>
    </ROW>
    </ROWSET>;
    ]]>
    </mx:Script>
    <mx:DataGrid width="100%" height="100%" id="dgMain"
    dataProvider="{myXML.ROW}"
    fontFamily="Verdana" fontSize="10" color="#000066">
    <mx:columns>
    <mx:DataGridColumn headerText="Note"
    dataField="NOTE_TX"/>
    <mx:DataGridColumn headerText="Points" dataField="POINT"
    id="dgcPoints"
    itemRenderer="MyComponents.MyItemRenderer"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>
    MyItemRenderer.as
    // ActionScript file
    package MyComponents {
    import mx.controls.*;
    import mx.core.*;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.*;
    import flash.display.*;
    import mx.core.*;
    import mx.controls.*;
    import flash.events.*;
    import mx.managers.PopUpManager;
    import mx.events.*;
    public class MyItemRenderer extends mx.core.Container
    implements IListItemRenderer{
    public function MyItemRenderer() {
    super();
    override public function set data(oValue:Object):void {
    this.removeAllChildren();
    //oValue contains whole ROW in XML format...
    var n:int = 0;
    if(this.width==0){
    trace("set data:width 0!");
    if (oValue != null && this.width>0) {
    var m:int = this.getChildren().length;
    var nWidth:int = this.width;
    var xXML:XML = new XML(oValue);
    for(var s:String in xXML.POINTS.children()){
    var nXValue:int = xXML.POINTS.children()[s].X_VALUE;
    //Total width is from 0-9, padding of 5 on left and right to
    account for circle width
    var n:int = (((nXValue -1)/10) * (this.width-10)) + 5;
    trace("set data: Width:" + this.width + " XValue:" + nXValue
    + " X:" + n);
    var u:PointComponent = new PointComponent(0x0000EE, n);
    this.addChild(u);
    PointComponent.as
    package MyComponents
    import mx.core.UIComponent;
    import mx.controls.Alert;
    public class PointComponent extends UIComponent
    public function PointComponent(pnColor:uint, pnX:int){
    super();
    graphics.clear();
    graphics.beginFill(pnColor);
    graphics.drawCircle(pnX, 10, 7);
    }

    A complete runnable example, that's great, I will give it a
    try.
    In the meantime, for "...set data is called four times where
    there are three rows...", I have noticed this as well but have no
    explanation. The first time, the "value" object is "null", so I
    always wrap the code in if (value != null) {}
    I'll post when I get a chance to look at your sample.
    Tracy

  • [svn:fx-trunk] 11170: ItemRenderer changes.

    Revision: 11170
    Author:   [email protected]
    Date:     2009-10-26 16:15:30 -0700 (Mon, 26 Oct 2009)
    Log Message:
    ItemRenderer changes.  Fixing some bugs with the autoDrawBackground flag.  Also making some PARB changes:
    1.  IItemRenderer.index -> itemIndex (affects DefaultItemRenderer, ItemRenderer, and ButtonBarButton).
    2.  GroupBase.renderBackgroundFill() (protected method) -> drawBackground() (mx_internal method)
    3.  ItemRenderer.handleBackgroundFill -> autoDrawBackground
    4.  Removed contentBackgroundColor from ItemRenderer
    Also, DefaultItemRenderer is now no longer an MXML file, but it is an AS-only class that extends UIComponent.
    QE notes: -
    Doc notes: Yes - Can you please look at the ASDocs for DefaultItemRenderer.as and the autoDrawBackground flag on ItemRenderer
    Bugs: -
    Reviewer: Deepa
    Tests run: checkintests, Mustella List, DataGroup, DropDownList
    Is noteworthy for integration: Yes
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBarButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGroup.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/IItemRenderer.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer .as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/DefaultComplexItemRenderer .mxml
    Added Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.as
    Removed Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/DefaultItemRenderer.mxml

    Gordon, it looks like its been a while since you made this post.  Not sure how valid it is now...   I am particularly interested in the LigatureLevel.NONE value.  It seems that it is no longer supported.
    How do I turn of ligatures in the font rendering?
    My flex project involves trying to match the font rendering of Apache's Batik rendering of SVG and ligatures have been turned off in that codebase.  Is there any way (even roundabout) to turn ligatures off in flash?
    Thanks,
    Om

  • Bug in drop-in ItemRenderer?

    Hello,
    In all the examples I have seen online most of the Drop-In
    ItemRenderers use an ArrayCollection when a CheckBox is used as the
    DataProvider. I tried using an XMLList collection instead and I
    don't get any of the CheckBoxes in the ItemRenderer to be checked
    when the value is true, by default they all appear as unchecked.
    I've tested the values displayed when I take out the ItemRenderer
    and they show true or false.
    I've tried to see if it made a difference that the values
    were either text nodes or attr nodes and it didn't seem to care. So
    is this a problem with the Drop-in ItemRenderer? Is this expected
    behavior? Do I need to create a LabelFunction to cast the XML value
    as a boolean? (I tried and it didn't work either)
    I'm kinda baffled and would appreciate any help.
    Thanks,
    Hoyt
    The code is very simple:
    XML file:
    <root>
    <test>
    <testValues>
    <boolval attr="false">true</boolval>
    <boolval attr="true">false</boolval>
    <boolval attr="true">true</boolval>
    <boolval attr="true">false</boolval>
    </testValues>
    </test>
    </root>
    The mxml file:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" creationComplete="testXML.send();"
    cornerRadius="8" borderStyle="solid" borderThickness="2"
    borderColor="#000000" themeColor="#00FF00"
    backgroundGradientAlphas="[1.0, 1.0]"
    backgroundGradientColors="[#008080, #008080]">
    <mx:Script>
    <![CDATA[
    import
    mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
    import mx.collections.HierarchicalData;
    import mx.binding.utils.ChangeWatcher;
    import mx.events.ListEvent;
    import mx.events.ItemClickEvent;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.rpc.events.*;
    import mx.collections.XMLListCollection;
    import mx.controls.*;
    import mx.binding.*;
    import mx.binding.utils.BindingUtils;
    import mx.rpc.xml.*;
    [Bindable]
    private var testList:XMLListCollection;
    private function testXMLHandler(evt:ResultEvent):void {
    testList = new
    XMLListCollection(evt.result.test.testValues.boolval);
    txtArea.text += testList.toString();
    ]]>
    </mx:Script>
    <mx:HTTPService id="testXML"
    result="testXMLHandler(event)" resultFormat="e4x" url="
    http://localhost/~hoytng/Workspace/studentDB/xml/test.xml"/>
    <mx:DataGrid x="401" y="18" width="224" height="100"
    dataProvider="{testList}">
    <mx:columns>
    <mx:DataGridColumn headerText="Column 1"
    dataField="@attr"/>
    <mx:DataGridColumn headerText="Column 2"
    dataField="*"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    Hmm, I don't know off-hand if I'll be able to fix this, because of the following:
    1.  The selection list property returns a Wire reference...I don't
    know if there's a way for me to figure out which segment of a wire is
    selected.
    2.  The Insert method only takes a Wire reference...there's no way to
    tell it a particular segment of the wire on which you want the insert
    to take place.
    I'll look into it, but I'm not hopeful it can be fixed without some changes to the internals of VI Scripting...
    Thanks for the bug report.
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Flex spark dataGrid gridColumn itemrenderer binding bug

    I hava a TextInput within mx DataGrid gridColumn itemrenderer and binding its text to {data.f1} ,
    when I set DataGrid dataProvider column (0,0) to "value1" by actionsript code,
    it will update "value1" to TextInput field.
    But if I change to spark DataGrid, TextInput Text won't be changed.
    Please see below two samples, when user click "set var" button, it set dataProvider column (0,0) to "value1",
    sample1 is in mx comopent, it works fine and will update "value1" to TextInput Text.
    sample2 is in spark component, it did not work.
    anyone can help for spark component ?
    many thanks.
    *** sample1 (mx componet): ***
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    minWidth="955" minHeight="600"
      layout="absolute">
    <mx:Button x="235" y="52" label="set var" click="setVar()"/>
    <mx:DataGrid id="grid_1" dataProvider="{ia_row}" x="25" y="52">
      <mx:columns>
       <mx:DataGridColumn dataField="f1" headerText="Column 1">
        <mx:itemRenderer>
         <fx:Component>
          <mx:TextInput text="{data.f1}" width="95%"/>
            </fx:Component>
        </mx:itemRenderer>    
       </mx:DataGridColumn>
       <mx:DataGridColumn dataField="f2" headerText="Column 2"></mx:DataGridColumn>
      </mx:columns>
    </mx:DataGrid>
    <fx:Script>
      <![CDATA[
       import mx.collections.ArrayCollection;
       import mx.events.FlexEvent;
       [Bindable]
       private var ia_row:ArrayCollection = new ArrayCollection([
        {f1:"a1", f2:"b1"},
        {f1:"a2", f2:"b2"}
       private function setVar():void{
        var t_row:Object = ia_row.getItemAt(0);
        t_row.f1 = "value1";
        ia_row.setItemAt(t_row, 0);
      ]]>
    </fx:Script>
    </mx:Application>
    *** sample2 (spark componet): ***
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    minWidth="955" minHeight="600"     
    >
    <s:Button x="267" y="94" label="set var" click="setVar()"/>
    <s:DataGrid id="grid_1" x="55" y="94" width="204" height="139" dataProvider="{ia_row}">
      <s:columns>
       <s:ArrayList>
        <s:GridColumn dataField="f1" headerText="Column 1" width="120">
         <s:itemRenderer>
          <fx:Component>
           <s:GridItemRenderer>       
            <s:TextInput text="{data.f1}" width="95%"/>
             </s:GridItemRenderer>
          </fx:Component>
         </s:itemRenderer>    
        </s:GridColumn>
        <s:GridColumn dataField="f2" headerText="Column 2"></s:GridColumn>
       </s:ArrayList>
      </s:columns>
    </s:DataGrid>
    <fx:Script>
      <![CDATA[
       import mx.collections.ArrayCollection;
       import mx.events.FlexEvent;
       [Bindable]
       private var ia_row:ArrayCollection = new ArrayCollection([
        {f1:"a1", f2:"b1"},
        {f1:"a2", f2:"b2"}
       private function setVar():void{
        var t_row:Object = ia_row.getItemAt(0);
        t_row.f1 = "value1";
        ia_row.setItemAt(t_row, 0);
      ]]>
    </fx:Script>
    </s:Application>

    sir, I think it does not send CHANGE event to dataGrid, so my suggestion is following:
    private function setVar():void{
        var t_row:Object = ia_row.getItemAt(0);
        Alert.show(t_row.f1);
        t_row.f1 = "value1";
        ia_row.setItemAt(t_row, 0);
        ia_row.refresh();//it is used to dispatch Event if dataprovider was changed.

  • Cannot set the properties of an itemrenderer in sdk 4

    Hi,
    I have a project working in sdk 3 that creates an item renderer for a grid, and passes the field index to the renderer. In sdk 4, the
    property is null. Is this a bug? (code truncated)
    <?xml version="1.0"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off" horizontalGap="5" paddingLeft="6" implements="mx.core.IFactory">
        <mx:Script>
            <![CDATA[
                [Bindable] public var fieldIndex:int = -1;
                public function newInstance():*
                    return new statusItem();
                override public function set data(value:Object):void { 
                    super.data = value;
                    var status:String = "";
                    var statusImg:String = "";
                    if (value != null && value.length > 0 && fieldIndex > -1)   {
                        status = value[fieldIndex];       
                        if (status != null && status.length > 0) {
                            switch(status.toLowerCase()) {
                                case "open" : img.source = Icon1;
                                            break;
                                case "closed" : img.source = Icon2;
                                    break;
                                default : img.source = Icon9;
                                    break;
                    else {
                        img.source = errorIcon;
            ]]> 
        </mx:Script> 
        <mx:Image id="img" source="{blankIcon}" verticalAlign="middle" width="10" height="10" /> 
        <mx:Label id="lbl" text="{data[fieldIndex]}" /> 
    </mx:HBox> 
    parent code
    var sRenderer:ClassFactory = new ClassFactory(statusItem);
                                                sRenderer.properties = { fieldIndex: x };
                                                dgc.itemRenderer = sRenderer;
    It is simple code that works in version 3, but not in version 4.
    thanks,
    Jon

    Okay, I cant remember whether it was NULL.
    All I know is that it is not being set using SDK 4 and it works perfectly in SDK 3.
    Jon

  • Tree component bug (?) and some questions

    Hi! I have some problems and questions about tree component.
    Problems:
    1. I have an expanded tree with ~300 items. Each item label
    displayed in 2-3 strings. After QUICK tree scrolling using mouse
    wheel (I make 3-5 scrolls) for most of items displayed only last
    string and one empty string :(
    Bug of tree renderer? Is it fixable?
    Questions:
    1. Can I have font color X for tree item 1 and font color Y
    for tree item 2?
    2. I have a tree with ~300 items. Expand/Collapse tree
    operations takes 5 to 10 seconds on Core2Duo. Is it possible to
    speed up this operations?
    Code:

    Hello.
    About problem 1.
    I faced this problem several times, cann't understand the
    problem. May be it's a bug.
    Questions.
    1. Of course you can. Write itemRenderer for this.
    2. Tree has effects for expanding and collapse events, you
    can reduce times for them.

  • Flex Spark DataGrid BUG skipping rows on refresh

    I have a small one file example that demonstrates this Flex DataGrid bug.
    I tried to report it to Flex bugs and the page timed out.
    I am filling a column in a spark datagrid with checkboxes to select that row.
    In the header of that column is a checkbox to select ALL the rows.
    However, the middle row is not getting refreshed so the display is wrong.
    The checkbox looks empty when the backing value is correct.
    I have added a print to the code that sets the values in the data and it is setting everyone.
    But when I print the isSelected code it is NOT being called on ONE (the middle) visible row.
    If I move away or scroll up and down the check box shows the check mark.
    So My only conclusion is that refresh has a bug.
    Here is the example that demonstrates the problem.
    Simply select the header checkbox and the 3rd checkbox does not get updated on refresh.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  private static var values:Array = [
                                            {selected: false, position: 1},
                                            {selected: false, position: 2},
                                            {selected: false, position: 3},
                                            {selected: false, position: 4},
                                            {selected: false, position: 5}
                                  [Bindable]
                                  public static var datalist:ArrayCollection = new ArrayCollection( values );
                                  public static function updateDataList( value:Boolean ):void
                                            for each( var item:Object in datalist ) {
                                                      trace( "updated: " + item.position );
                                                      item.selected = value;
                                            datalist.refresh();
                        ]]>
              </fx:Script>
              <s:DataGrid dataProvider="{datalist}">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="position" width="200"/>
                                            <s:GridColumn width="34" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer textAlign="center">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        private function changeSelection( data:Object, event:MouseEvent ):void
                                                                                                                  data.selected = ! data.selected;
                                                                                                        private function isSelected( data:Object ):Boolean
                                                                                                                  trace( "isSelected: " + data.position );
                                                                                                                  return data.selected;
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox id="selbox" label="" selected="{isSelected(data)}"
                                                                                                                  click="changeSelection(data, event)"/>
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                                      <s:headerRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer height="30">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        [Bindable]
                                                                                                        private static var selectAll:Boolean = false;
                                                                                                        private function changeAllSelection( event:MouseEvent ):void
                                                                                                                  selectAll = ! selectAll;
                                                                                                                  Main.updateDataList( selectAll );
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox label="" selected="{selectAll}"
                                                                                                                  click="changeAllSelection(event)"/ >
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:headerRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
              </s:DataGrid>
    </s:Application>
    Here is an image of the failed result... after selecting the top checkbox.
    Below is an image of the output produced by the two traces.
    Notice that the refresh has not called isSelected on the 3rd element.

    I have a small one file example that demonstrates this Flex DataGrid bug.
    I tried to report it to Flex bugs and the page timed out.
    I am filling a column in a spark datagrid with checkboxes to select that row.
    In the header of that column is a checkbox to select ALL the rows.
    However, the middle row is not getting refreshed so the display is wrong.
    The checkbox looks empty when the backing value is correct.
    I have added a print to the code that sets the values in the data and it is setting everyone.
    But when I print the isSelected code it is NOT being called on ONE (the middle) visible row.
    If I move away or scroll up and down the check box shows the check mark.
    So My only conclusion is that refresh has a bug.
    Here is the example that demonstrates the problem.
    Simply select the header checkbox and the 3rd checkbox does not get updated on refresh.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
              <fx:Script>
                        <![CDATA[
                                  import mx.collections.ArrayCollection;
                                  private static var values:Array = [
                                            {selected: false, position: 1},
                                            {selected: false, position: 2},
                                            {selected: false, position: 3},
                                            {selected: false, position: 4},
                                            {selected: false, position: 5}
                                  [Bindable]
                                  public static var datalist:ArrayCollection = new ArrayCollection( values );
                                  public static function updateDataList( value:Boolean ):void
                                            for each( var item:Object in datalist ) {
                                                      trace( "updated: " + item.position );
                                                      item.selected = value;
                                            datalist.refresh();
                        ]]>
              </fx:Script>
              <s:DataGrid dataProvider="{datalist}">
                        <s:columns>
                                  <s:ArrayList>
                                            <s:GridColumn dataField="position" width="200"/>
                                            <s:GridColumn width="34" >
                                                      <s:itemRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer textAlign="center">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        private function changeSelection( data:Object, event:MouseEvent ):void
                                                                                                                  data.selected = ! data.selected;
                                                                                                        private function isSelected( data:Object ):Boolean
                                                                                                                  trace( "isSelected: " + data.position );
                                                                                                                  return data.selected;
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox id="selbox" label="" selected="{isSelected(data)}"
                                                                                                                  click="changeSelection(data, event)"/>
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:itemRenderer>
                                                      <s:headerRenderer>
                                                                <fx:Component>
                                                                          <s:GridItemRenderer height="30">
                                                                                    <fx:Script>
                                                                                              <![CDATA[
                                                                                                        [Bindable]
                                                                                                        private static var selectAll:Boolean = false;
                                                                                                        private function changeAllSelection( event:MouseEvent ):void
                                                                                                                  selectAll = ! selectAll;
                                                                                                                  Main.updateDataList( selectAll );
                                                                                              ]]>
                                                                                    </fx:Script>
                                                                                    <s:layout>
                                                                                              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
                                                                                    </s:layout>
                                                                                    <s:CheckBox label="" selected="{selectAll}"
                                                                                                                  click="changeAllSelection(event)"/ >
                                                                          </s:GridItemRenderer>
                                                                </fx:Component>
                                                      </s:headerRenderer>
                                            </s:GridColumn>
                                  </s:ArrayList>
                        </s:columns>
              </s:DataGrid>
    </s:Application>
    Here is an image of the failed result... after selecting the top checkbox.
    Below is an image of the output produced by the two traces.
    Notice that the refresh has not called isSelected on the 3rd element.

  • Can't focus on custom itemRenderer?

    I have made a custom itemRenderer doubling as an itemEditor
    following the guidelines in the documentation.
    However, even though I have set the rendererIsEditor="true",
    when tabbing amongst other editable fields, the controls inside the
    itemRenderer do not receive focus. I can't help but think this is
    an oversight/bug but is there any way to jury-rig the itemRenderer
    to focus properly? At the moment my component is simply a CheckBox
    inside an HBox.
    Anyway, here is my code so you can see for yourself (I have
    included a CheckBox as itemRenderer so you can see the *desired*
    effect.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
    <![CDATA[
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.Alert;
    [Bindable]
    public var dp:Array = [{num:2, bool:true}, {num:3,
    bool:false}];
    ]]>
    </mx:Script>
    <mx:DataGrid id="test" editable="true"
    dataProvider="{dp}">
    <mx:columns>
    <mx:DataGridColumn dataField="num" headerText="num" />
    <mx:DataGridColumn dataField="bool"
    headerText="Sent"
    itemRenderer="mx.controls.CheckBox"
    rendererIsEditor="true" editorDataField="selected" />
    <mx:DataGridColumn dataField="num" headerText="num"
    editable="true" />
    <mx:DataGridColumn dataField="bool" headerText="Sent"
    rendererIsEditor="true" editorDataField="blorch">
    <mx:itemRenderer>
    <mx:Component>
    <mx:HBox horizontalAlign="center">
    <mx:Boolean id="blorch" />
    <mx:CheckBox id="check" selected="{data.bool}"
    change="blorch=check.selected" />
    </mx:HBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <mx:DataGridColumn dataField="num" headerText="num"
    editable="true" />
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    nevermind... I found the answer a few pages later in the
    docs...
    you have to implement the IFocusManagerComponent interface
    and then override drawFocus as below to set the focus on the
    checkBox... hope it works for multiple controls...
    <mx:HBox horizontalAlign="center"
    backgroundColor="#9933EE"
    implements="mx.managers.IFocusManagerComponent">
    <mx:Script>
    <![CDATA[
    override public function drawFocus(focused:Boolean):void {
    check.setFocus();
    ]]>
    </mx:Script>
    <mx:Boolean id="blorch" />
    <mx:CheckBox id="check" selected="{data.bool}"
    change="blorch=check.selected"
    updateComplete="blorch=check.selected" />
    </mx:HBox>

  • Setting a DataProvider to a custom itemRenderer in a DataGrid

    Hi,
    I've got a DataGrid, with one column using a custom AS itemRenderer to display a ComboBox.  Everything works, but there are various "wierd" behaviors occuring (when I remove a row, the ComboBox of the next row in line resets to it's label, but none of the others do...  When I add a row, various apparently random comboboxes change their selectedItem, etc...)
    Anyways, I had some luck isolating each of these individual bugs and squashing them, but each time I do, others seem to pop up.  I suspect the main issue is the way I'm setting the ComboBox's dataProvider.  The dataProvider is dynamic - an XML file generated from a MySQL table using PHP.  Knowing no other way to do so, I'm overriding the set data method and explicitly setting it there, like so:
    override public function set data(value:Object):void{
      super.data = value;
      dataProvider = value.uom;  // value.uom is the XML
    Is there a better way to set the data provider - an approach where I can set it once and therefor avoid the override entirely?  Again, the itemRenderer is an ActionScript class, and not implemented with XML...
    <mx:DataGridColumn itemRenderer="renderers.UOMBox" dataField="uom" headerText="UOM" />
    and...
    package renderers{
      public class UOMBox extends ComboBox{
        ... etc ...
    Thanks in advance.

    How does this code work for you:
    override public function set data(value:Object):void{
      if(value != null)  {
        super.data = value;
        dataProvider = value.uom;  // value.uom is the XML
      super.invalidateDisplayList();
    The missing invalidateDisplayList in your code might be what will help with your problems.
    Chris

  • [svn:fx-trunk] 11276: Turning the default of ItemRenderer' s autoDrawBackground property to true.

    Revision: 11276
    Author:   [email protected]
    Date:     2009-10-29 13:25:24 -0700 (Thu, 29 Oct 2009)
    Log Message:
    Turning the default of ItemRenderer's autoDrawBackground property to true.  This is part of the changes outlined here: http://opensource.adobe.com/wiki/display/flexsdk/ItemRendererChanges
    This will break existing ItemRenderers because now we are drawing a rectangular background for rollover/selection/caretting that was not being drawn before.  Existing item renderers should be updated to either opt out of this new behavior by explicitly setting autoDrawBackground to false or by updating their ItemRenderers to expect this behavior.
    QE notes: Most tests should have already been updated.  If tests with item renderers are broken, please update them.
    Doc notes: -
    Bugs: -
    Reviewer: Pete F.
    Tests run: checkintests
    Is noteworthy for integration: Yes
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ItemRenderer .as

    Gordon, it looks like its been a while since you made this post.  Not sure how valid it is now...   I am particularly interested in the LigatureLevel.NONE value.  It seems that it is no longer supported.
    How do I turn of ligatures in the font rendering?
    My flex project involves trying to match the font rendering of Apache's Batik rendering of SVG and ligatures have been turned off in that codebase.  Is there any way (even roundabout) to turn ligatures off in flash?
    Thanks,
    Om

  • [svn:fx-trunk] 9117: DropDownList bug fixes

    Revision: 9117
    Author:   [email protected]
    Date:     2009-08-05 14:12:45 -0700 (Wed, 05 Aug 2009)
    Log Message:
    DropDownList bug fixes
    http://bugs.adobe.com/jira/browse/SDK-22536 - Spark DropDownList highlight not working as expected when navigating using keyboard with useVirtualLayout=true
    In the keyDownHandler function, the DropDownList was trying to set the selected state on the new itemRenderer. However, in a virtual layout, the renderer might not exist until later.
    The fix is to update the renderer in the updateRenderer function. This function calls isItemIndexSelected in order to choose which item to select. I have overridden the behavior to select the proposedSelectedIndex instead of the selectedIndex.
    I have also renamed proposedSelectedIndex to userProposedSelectedIndex to avoid a naming conflict in ListBase.
    http://bugs.adobe.com/jira/browse/SDK-22406 - Spark DropDownList popup behaves unexpectedly when component is initially disabled
    I removed the call in the partAdded function that was setting the openButton to disabled. Spark components handle disabling by blocking user interaction.
    QE notes: Add test cases for both bugs
    Doc notes: None
    Bugs: SDK-22536, SDK-22406
    Reviewer: Ryan
    Tests run: DropDownList
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22536
        http://bugs.adobe.com/jira/browse/SDK-22406
        http://bugs.adobe.com/jira/browse/SDK-22536
        http://bugs.adobe.com/jira/browse/SDK-22406
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as

    This bug figures out also when creating a custom spark ComboBox, then trying to programatically update the userProposedSelectedIndex property. The proposed selected index is selected, but does not apply the same skin as when mouse is on rollover or item is selected due to up and down keys.
    The issue seems like updating the status of the item renderer to rollover or selected to get the same skin applied.
    Please could you attach DropDow nList.as that you edited ?
    Thank you so much.

  • DataGrid tooltip doesn't work for customized itemRenderer

    I have a DataGrid with one column is a customized renderer,
    when I try to use the dataTripFunc, it is not showing tooltips,
    same function works for the other non-customized column, here is
    the code:
    <mx:DataGrid id="myDataGrid" dataProvider="{dataContent}"
    width="100%" height="100%">
    <mx:columns>
    <mx:DataGridColumn dataField="name" headerText=""/>
    <mx:DataGridColumn dataField="DateTime"
    headerText="DateTime" showDataTips="true"
    dataTipFunction="cellDataTipFunc"/>
    <mx:DataGridColumn dataField="ImgBar" headerText="ImgBar"
    itemRenderer="ImgBarCell" minWidth="40" showDataTips="true"
    dataTipFunction="cellDataTipFunc"/>
    </mx:columns>
    </mx:DataGrid>
    public function cellDataTipFunc(item:Object):String {
    return "hello world";
    Where the itemRenderer -- "ImgBarCell" is a customized HBox
    component with a label and image on it.
    The tooltip -- "helloworld" shows up for column "DateTime",
    but not for customized ImgBar.
    Does this one have anything to do with event generation for
    customized itemRenderer? Or a bug in flex2?

    Hi
    The TREX server (service) must started and be contactable by RFC - this can be checked by carrying out the actions listed above. (Refer OSS Note - 866547 Error when accessing TREX server for more details )
    <b>Please have a look at the following SAP OSS Note, which will help -></b>
    Note 851106 - Search in catalog from SRM leads to "Service not reachable"
    <u>Other related OSS Notes</u>
    Note 973594 Cross Catalog Search - Configuration
    Note 894717 Items from Cross Catalogs Result does not appears in step 2
    Note 803731 Cross-category search returns no result
    Note 847137 OCI, cross-catalog search: detail display
    Note 996885 Cross Catalog Search - Timeout while accessing MDM Catalog
    1023487 cross-catalog-serach in portal opens up a duplicate window
    1020025 Item detail display in Cross Catalog Search
    1027352 Item detail display in Cross Catalog Search
    Note 866547 - Error when accessing TREX server
    Note 988427 - Update to TREX 6.1 Rev 27
    Note 994623 - Hierarchy Buffer and BIA
    Note 1030056 - Improvement in the Search within Results feature of CSE
    Note 798988 CCM/CSE: Sorting sometimes returns no results
    Note 778688 TREX_INDEX_MANAGER unit test update_view(): incorrect search
    Note 808754 Display sequence of the characteristics is not changeable
    Note 794325 - Error in OCI transfer in the BAdI /CCM/OCI_SCALEPRI
    Note 745235 Search ability changes to cross-catalog characteristics
    Note 724097 - Search of the comp. in case of structured characteristics
    Note 743643 Search ability change in cross-catalog characteristics
    Note 847551 Displaying date, time, and timestamp in the CSE
    Note 750756 Program for the deletion/clean up of TREX indexes
    Do update me as well.
    Regards
    - Atul

  • DropDownList Bug?

    Is this a bug or am I missing something?  Use a dropdownlist in your an application.
    For the dataprovider use something like the following.
    sw0-clls.0.sjs-w80.slkfjsd.kfjs-343
    sw0-clls.2220.sjs-w80slkfjssdfd-dkfjs
    sw0-clls.0s32333.sjs-w80slkfjsds-dfdkfjs
    (Yes the above are weird but we have our reasons)
    Then use width=90 and truncate=1 on the simpleText in the an itemrenderer and/or the dropdownlistbuttonskin.
    The truncation appears to be in random spots like so
    sw0-clls...
    sw0-...
    sw0-c...
    Shouldn't they go to at least a width=90 before truncating?

    Can you file a bug (and include your test case) at http://bugs.adobe.com/flex/ and we can take a look at this.
    Peter

Maybe you are looking for

  • I have one Itunes account for myself and children.  Can we facetime each other on different devices?

    I have one Itunes account for myself and my children.  Can we facetime each other on different devices?

  • Itunes wont say my ipod is connected when i plug it in HELP!

    I need BIG help I've tryed everything but i can't find out whats wrong. When i plug my ipod in to my computer all it does is charge it doesnt up load or say that its pluged in. I WANT MY NEW SONGS ON MY IPOD I WANT TO NO WHATS GOING ON. CAN SOMEONE P

  • OPC Comm. with a NI PCI-FBUS/2

    I lose communications intermittenly between my VB.net program and the NI-OPC Server.  (Once per week) It occurs after a long period of no use by the operator, usually overnight.  The program and network is always active 24 hours a day.  Only a screen

  • IPhone 6 won't delete mail

    I bought a new iP6 two weeks ago.  First smartphone I have owned.  When I try to delete spam from my email, it gives a message something like "can't delete message".  What is going on?

  • Stream from laptop to TV

    Have Pavillion dv7-4177nr laptop. It says I can stream from it to my TV.  with TV adaptor and HDMI.  I have HDMI hooked ot TV from cable box.  What does TV adaptor look like and can you help on how to hook everything up? Thanks