For the event part, CellRenderers have access to both the cell and list they 
are in.  So, if you do this.listOwner; that's the DataGrid.  You can either 
dispatch events and make them bubble, or dispatch them from the DataGrid's 
scope; listOwner.dispatchEvent.

Additionally, if you want to update the dataProvider's data, easiest way is 
to use editField.  For example, if your cell renderer has a CheckBox in it, 
in the click event, you could do:

var lbl:String = getDataLabel();
var index:Number = getCellIndex().itemIndex;
listOwner.editField ( index, lbl, my_ch.selected);

----- Original Message ----- 
From: "Derek Vadneau" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, January 25, 2006 2:08 PM
Subject: [Flashcoders] Cellrenderer confirmation


Hi all,

I just want to verify a few things in case I've thought about this
incorrectly.

I've built three cellrenderer classes for a datagrid.  I've got everything
working but I'm trying to optimize the classes so things don't get cycled
when they don't need to be.

Am I correct in assuming that a datagrid (and a list-based component in
general) only produces X number of instances of a cellrenderer, where X is
the number of VISIBLE rows, as opposed to TOTAL rows?

When I scroll, it's as if the rows cycle: 0-6 are visible.  Scroll so 7 is
visible, but the cellrenderer in row 7 traces out data that was kept in
row 0.

If that's the case, then you can't store row-specific information in a
cellrenderer instance.  In which case, my optimizations are probably as
good as they're going to get.

Also, I've searched through the archives and it seems the only way to
trigger the change event, or any event, in the datagrid from the
cellrenderer is to have the cellrenderer execute the dispatchEvent method.
Is that the only way?  It seems a little hackish to me.  It does work, but
you'd think there would be a mechanism in place to have the cellrenderer
tell the datagrid that it wants to update the dataProvider.

Any thoughts?


Derek Vadneau


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to