I think you ran into the same thing I did, the datagrid will render
things oddly sometimes, I had to use the dataChange function in my
itemrenderer to get what I wanted.

I go into more detail at
http://blog.dougco.com/coding/flex/doesnt-seem-like-normal-behaviour-for-datagrid/
if that is helpful.

-d

--- In [email protected], Vaan S Lanko <[EMAIL PROTECTED]> wrote:
>
> Hello Flexies, just curious is this normal behaviour or am I doing 
> something stupendously wrong ?
> 
> I have recreated this issue in a small project with 2 files,
> 
> Service.as AS3 Class file
> 
> package
> {
>     public class Service
>     {
>         public function
Service(_name:String,_price:Number,_category:String)
>         {
>             super();
>             this.name = _name;
>             this.price = _price;
>             this.category = _category;
>         }
>            
>         public var name:String;
>         public var price:Number;
>         public var category:String;
>        }
> }
> 
> and the main.mxml
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:WindowedApplication
>     xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical"
>     initialize="initData()"
>     >
>    
>     <mx:Script>
>         <![CDATA[
>             import mx.collections.ArrayCollection;
>             private var dataArray:Array = new Array();
>             private var testArrayCollection:ArrayCollection = new 
> ArrayCollection();
>            
>             private function initData():void
>             {
>                 dataArray.push(new Service("Blah 1",5.5,"Cat1"));
>                 dataArray.push(new Service("Blah 2",5.5,"Cat1"));
>                 dataArray.push(new Service("Blah 3",5.5,"Cat1"));
>                 dataArray.push(new Service("Blah 4",5.5,"Cat1"));
>             }
>            
>             private function addToCollection():void
>             {
>                 testArrayCollection.addItem(zomboCombo.selectedItem);
>             }
>            
>         ]]>
>     </mx:Script>
>     <mx:DataGrid dataProvider="{testArrayCollection}">
>         <mx:columns>
>             <mx:DataGridColumn headerText="name" dataField="name"/>
>             <mx:DataGridColumn headerText="price" dataField="price"/>
>             <mx:DataGridColumn headerText="category"
dataField="category"/>
>         </mx:columns>
>     </mx:DataGrid>
>     <mx:ComboBox labelField="name" id="zomboCombo" 
> dataProvider="{dataArray}"></mx:ComboBox>
>     <mx:Button label="Add selected" click="addToCollection()"/>
>    
> </mx:WindowedApplication>
> 
> Run the app, select a Service with the combobox, hit the add 'selected 
> button' a few times (consecutively without changing the combo
selection) 
> and with your mouse hover over the datagrid. Only the last entry will 
> have a mouseover selection highlighted. I dont quite understand this 
> behaviour, can someone enlighten me to what it is i'm doing wrong,
or is 
> it a bug ?
> 
> Cheers
> Vaan
>


Reply via email to