More comments inline...

--- In flexcoders@yahoogroups.com, "Theodore E Patrick" <[EMAIL PROTECTED]>
wrote:
> Here is a jewel from the DataProvider Event API. This allows you to
refresh
> a single row of any control using a dataprovider, from the
dataprovider
> without knowing the control instance. Basically updateViews
broadcasts
> events to the subscribed controls. Whatever control(s) are using
this
> DataProvider will update their view for index 2.
> 
> MydataProvider.updateViews( 'updateItem' , 2 )
> 
> Pretty cool, eh! :)

Very cool

> Extending DataGridColumn is confusing since you are really working
with a
> node within the DataGrid.columns array. The CellRenderer API depends
on this
> structure when rows are being laid out. The only thing that would be
useful
> here is the ability to shove extra data into the Array node
specifically
> events you need to listen to.

This is *exactly* what I want to do!  I just keep getting that damn
NullPointerException!

> 
> I wrote a cellRenderer that looked up event data within the
DataGrid.columns
> array. The cellRenderer would add the function instance that sits
in the
> DataGrid.columns[N] column data when the cell was instanciated. This
way you
> could set an event on the column, and your cell Renderer could pick
it up.

This is exactly what I'm currently doing as a workaround.  The problem
is that the function instance has to live in the same mxml file that
declares the DataGrid.  I'm out of luck if I want to reference a
function out in a viewHelper or formatter or some other object. 
That's why I'd love to have the DataGridColumn itself emit an *event*
rather than have the CellRenderer instance directly call a function...
then Flex's MXML compiler will work all the magic of creating an
intermediate function to handle the event with whatever code you stash
in the DataGridColumn's "linkClick" attribute (or whatever event your
cell is emitting).  I really would like this:
<custom:MyDataGridColumn
linkClick="anyExternalObject.handleEvent(event)" /> 
Rather than this:
<custom:MyDataGridColumn linkClick="localFunctionInstance" /> 

> I do something non-standard with CellRenderer. If you create
instances
> within createChildren, the DataGrid performance is much worse
because the
> DataGrid spends its time overwriting cells with new control
instances.
> Ideally you only want to createChild once and update the view when
the data
> changes. I accomplish this by  instanciating inner components within
> setValue not createChildren. In several cases I have seen pretty
large
> performance gains in doing things this way. The cellRenderer drag is
related
> to the isntanciation time of creating inner controls every time
anything
> moves over the datagrid. This is a huge waste of player energy.
> 
> function setValue( str:String , item:Object , sel:Boolean ) {
>               
>       //instanciate a cell only once and only if data is present!     
>       if( ! com && item != undefined ){                       
> 
>               //add my TextInput Control in there.
>               com = createObject( "TextInput" , "com" , 1 )
> 
>               //listen for change and fire a function stored in the column
>  com.addEventListener( "change" , mx.util.Delagate.create( com ,
> listOwner.getColumnAt( this.getCellIndex().columnIndex ).change  ) )
> 
>               size()                  
> 
>       }
> }
> 
> You will need a custom DataGrid Column object to get the change
event stored
> within the object. Although I think you have this done already.

Neat trick... I'll keep that in mind! Thanks, Ted





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to