If you set the headerRenderer, then it will be in the header.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of letterpigeon
Sent: Tuesday, November 20, 2007 11:37 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Performance Impact when using custom item
renderer

 

Hi Scott,

Somewhere in my code, I'm setting up the configuration of all the
columns, and I'm doing something like this:

var ignoreColumnConfig:ColumnConfig = new
ColumnConfig;
ignoreColumnConfig.dataField = "ignore";
ignoreColumnConfig.headerText = "Ignore";
ignoreColumnConfig.editable = false;
ignoreColumnConfig.itemRenderer = new
ClassFactory(CenteredCheckBoxItemRenderer);
ignoreColumnConfig.headerRenderer = new
ClassFactory(CheckedBoxHeaderRenderer);
columnConfigs.push(ignoreColumnConfig);
var dynamicGrid:DynamicDataGrid = new
DynamicDataGrid
dynamicGrid.columnsConfig = columnConfigs;

Then in my custom datagrid class, I'm constructing the data grid columns
as follow:

public function set columnsConfig(value:Array):void
{
_columnsConfig = value;
var columnArray:Array = new Array();

for each (var config:ColumnConfig in _columnsConfig)
{
var newColumn:DataGridColumn = new DataGridColumn;
newColumn.headerText = config.headerText;
newColumn.dataField = config.dataField;
newColumn.editable = config.editable;
if(_columnFilterEnabled)
{
var headerRendererClassFactory:ClassFactory;

headerRendererClassFactory = config.headerRenderer;

newColumn.headerRenderer =
headerRendererClassFactory;
}

if(config.itemRenderer!=null)
{
newColumn.itemRenderer = config.itemRenderer;
}

columnArray.push(newColumn);
}

this.columns = columnArray;
}

I'm not sure how to post this code snippet in a code block. I apologize
if it's hard to read. Thanks a lot for your help.

Ban
--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, Scott Melby <[EMAIL PROTECTED]> wrote:
>
> Nope... I use it quite a bit. Must be a bug in the way you are
> specifying the renderer. Can you post a code snippet?
>
> Scott
>
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com <http://www.fastlanesw.com> 
>
>
>
> letterpigeon wrote:
> >
> > Hi Scott,
> >
> > Not sure why if I only use a checkbox (or CenteredCheckBox) as the
> > item renderer, a checkbox also appears on the header of that column.
> > Have you seen this problem before?? Thanks.
> >
> > Ban
> >
> > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> > <mailto:flexcoders%40yahoogroups.com>, Scott Melby smelby@ wrote:
> > >
> > > Should have mentioned a couple of quick cheats in case you have
not
> > > thought of them... if you use Alex's centered image renderer then
you
> > > could probably do either of the following very easily
> > >
> > > 1) Put the label in the column next to the image
> > > 2) Just show the image and set the data tip for the column to be
the
> > > label text.
> > >
> > > hth
> > > Scott
> > >
> > > Scott Melby
> > > Founder, Fast Lane Software LLC
> > > http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >
> > >
> > >
> > >
> > > Scott Melby wrote:
> > > > Check out CenteredCheckBox on Alex's blog (assuming you want it
> > > > centered, otherwise just use CheckBox). I think Alex's blog also
has
> > > > something for a centered image which should be easily adaptable
to
> > add
> > > > the text next to it (if it doesn't already support it). You can
> > > > contact me off list if you want help with the image one.
> > > >
> > > > Scott
> > > > Scott Melby
> > > > Founder, Fast Lane Software LLC
> > > > http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >
> > > >
> > > >
> > > > letterpigeon wrote:
> > > >>
> > > >> Hi Scott and Alex,
> > > >>
> > > >> Thanks for all your help. I adopted Alex's example of the
> > > >> backgroundColorRenderer and it worked really well. So now I'm
using
> > > >> this lightweight for most of the columns in my datagrid except
2,
> > > >> which are both hbox'es. One to display a checkbox, and another
one to
> > > >> display an image along side with the text. What
components/classes do
> > > >> you think should be used to further improve performance?
Thanks.
> > > >>
> > > >> Ban
> > > >>
> > > >> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> > <mailto:flexcoders%40yahoogroups.com>
> > > >> <mailto:flexcoders%40yahoogroups.com>, Scott Melby <smelby@>
wrote:
> > > >> >
> > > >> > Ban -
> > > >> >
> > > >> > I don't think TextInput is nearly as lightweight as you might
> > think.
> > > >> Do
> > > >> > you really need them all to be editable at all times?
Typically I
> > > >> use a
> > > >> > lightweight itemrenderer derived from UIComponent etc. and
use a
> > > >> > separate itemEditor (TextInput, ComboBox, DateField), etc.
when the
> > > >> user
> > > >> > clicks on a particular data value (row/column).
> > > >> >
> > > >> > hth
> > > >> > Scott
> > > >> >
> > > >> > Scott Melby
> > > >> > Founder, Fast Lane Software LLC
> > > >> > http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >
> > <http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >>
> > > >> >
> > > >> >
> > > >> >
> > > >> > letterpigeon wrote:
> > > >> > >
> > > >> > > Hi Scott,
> > > >> > >
> > > >> > > Thanks for your post. But I'm on flex 2 now so the
> > > >> > > AdvancedDataGridItemRenderer is not available to me. Also,
in
> > terms
> > > >> > > of keeping the item renderer as light weight as possible,
my item
> > > >> > > renderer is just a TextInput and I change its background
color by
> > > >> > > calling this.styleName = "ErrorCell" where "ErrorCell" is
> > defined in
> > > >> > > my stylesheet. But even if I comment all this out, & have
my item
> > > >> > > renderer just to renderer the text, I'm still seeing a
> > considerable
> > > >> > > performance hit just by using custom item renderers on all
the
> > > >> columns
> > > >> > > of my datagrid. Is this a limitation in flex that we must
> > trade off
> > > >> > > performance for using custom renderers heavily?? Thanks.
> > > >> > >
> > > >> > > Ban
> > > >> > >
> > > >> > > --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com> 
> > <mailto:flexcoders%40yahoogroups.com>
> > > >> <mailto:flexcoders%40yahoogroups.com>
> > > >> > > <mailto:flexcoders%40yahoogroups.com>, Scott Melby
<smelby@>
> > wrote:
> > > >> > > >
> > > >> > > > Check out this post <http://blog.fastlanesw.com/?p=25
<http://blog.fastlanesw.com/?p=25> 
> > <http://blog.fastlanesw.com/?p=25 <http://blog.fastlanesw.com/?p=25>
>
> > > >> <http://blog.fastlanesw.com/?p=25
<http://blog.fastlanesw.com/?p=25> 
<http://blog.fastlanesw.com/?p=25 <http://blog.fastlanesw.com/?p=25> >>
> > > >> > > <http://blog.fastlanesw.com/?p=25
<http://blog.fastlanesw.com/?p=25> 
> > <http://blog.fastlanesw.com/?p=25 <http://blog.fastlanesw.com/?p=25>
>
> > > >> <http://blog.fastlanesw.com/?p=25
<http://blog.fastlanesw.com/?p=25> 
> > <http://blog.fastlanesw.com/?p=25 <http://blog.fastlanesw.com/?p=25>
>>>> on my blog
> > > >> > > where
> > > >> > > > I discuss and demonstrate performance diffs using various
item
> > > >> > > renderers
> > > >> > > > in Flex. Source code is available if you run the app and
right
> > > >> click.
> > > >> > > > Notice how the optimized renderer does not use layout
> > containers
> > > >> > > such as
> > > >> > > > HBox, etc. Instead it extends the
AdvancedDataGridItemRenderer
> > > >> class.
> > > >> > > > In general you want to make your renderers as light
weight as
> > > >> possible.
> > > >> > > >
> > > >> > > > hth
> > > >> > > > Scott
> > > >> > > >
> > > >> > > > Scott Melby
> > > >> > > > Founder, Fast Lane Software LLC
> > > >> > > > http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >
> > <http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >>
> > > >> <http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >
> > <http://www.fastlanesw.com <http://www.fastlanesw.com>
<http://www.fastlanesw.com <http://www.fastlanesw.com> >>>
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > letterpigeon wrote:
> > > >> > > > >
> > > >> > > > > Hi all,
> > > >> > > > >
> > > >> > > > > I'm seeing a huge performance degradation while using
> > custom item
> > > >> > > > > renderer with a datagrid. My datagrid is using a custom
item
> > > >> renderer
> > > >> > > > > for all its column. And even if my item renderer does
> > nothing
> > > >> more
> > > >> > > > > than :
> > > >> > > > >
> > > >> > > > > public override function data(value:object)
> > > >> > > > > {
> > > >> > > > > super.data = value;
> > > >> > > > > }
> > > >> > > > >
> > > >> > > > > I'm still seeing a few more seconds delay compared to
not
> > > >> using custom
> > > >> > > > > item renderers for a data set of 50 rows or more.
> > > >> > > > >
> > > >> > > > > Just wondering if this is a known issue with flex due
to
> > heavy
> > > >> graphic
> > > >> > > > > rendering? Any pointers on how to speed things up a
> > little bit?
> > > >> > > Thanks.
> > > >> > > > >
> > > >> > > > > Ban
> > > >> > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> > >
> > > >> >
> > > >>
> > > >>
> > >
> >
> >
>

 

Reply via email to