Kyle,

 

Sorry to break this to you, but any renderer based on Image is way too
heavy to have 600 visible items.

 

You should embed the checkbox image, then make a subclass of UIComponent
that always generates an instance of the images as a child, then makes
it invisible or visible based on the data.

 

Should look something like this:

 

public class WAGridBooleanRenderer extends UIComponent implements
IListItemRenderer, IDropInListItemRenderer
{       
        [Embed("checkimage.jpg")]
        private static var CheckImage:Class;
 
        private var _data:Object;
        private var _listData:BaseListData;
        private var child:DisplayObject;
        private var text:String;
        private var tip:ToolTip;
        private var lastMeasuredHeight:Number = 0;
 
        public function WAGridBooleanRenderer()
        {
               super();
        }
        
        override public function get data():Object
        {
               return _data;
        }
        
        override public function set data(value:Object):void
        {
               _data = value;
               invalidateProperties();
        }
 
        override public function get listData():Object
        {
               return _listData;
        }
        
        override public function set listData(value:BaseListData):void
        {
               _listData = value;
        }
 
        override protected function createChildren():void
        {
               super.createChildren();
               child = new CheckImage();
               addChild(child);
        }
 
        override protected function commitProperties ():void
        {
               super.commitProperties();
                       var dataSelected:DataGridListData = listData as
DataGridListData;
                       
                       var dg:APIDataGrid = listData.owner as
APIDataGrid;
                       var column:WAGridHeaderColumn =
dg.columns[dataSelected.columnIndex];
                       if(column != null && column.storedColumn != null
&& column.storedColumn.type != null) {
                               for each(var colValue:ColumnValue in
column.storedColumn.type.possibleValues) {
                                      if(colValue.value ==
data[dataSelected.dataField]) {
                                              child.visible = true;
                                              } else {
                                              child.visible = false;
                                              }
                                      }
                               }
                       }
        }
 
        /**
         *  center the contentHolder
         */
        override protected function updateDisplayList(w:Number,
h:Number):void
        {
               super.updateDisplayList(w, h);
 
               if (child)
               {
                       child.x = (w - child.width) / 2;
                       child.y = (h - child.height) / 2;
               }
 
        }
 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Kyle Neath
Sent: Tuesday, September 11, 2007 8:42 AM
To: [email protected]
Subject: Re: [flexcoders] DataGrid: Horizontal Scrolling very slow

 

They're display only. Here's my renderer:
http://warpspire.com/misc/WAGridBooleanRenderer.as
<http://warpspire.com/misc/WAGridBooleanRenderer.as> 

I also tried using an embedded image -- seemed like the performance
was pretty similar between the two methods.

Thanks!

Kyle

 

Reply via email to