listOwner was put there for the explicit purpose of getting a reference to 
the grid.  Otherwise, you'd do some insane monkey-swing to walk your way up 
the timeline via cell... if you didn't have cell, replace with 
_parent._parent, blah blah blah.

This isn't AS3 bro, hehe!

Besides, it's documented and in the API, so its' legal and was put there for 
this exclpicit purpose.

Well.... yeah, I do actually.  editField:

editField("someValue", 2, newValue);

basically does this behind the scenes:

dataProvider[2]["someValue"] = newValue;
modelChanged();

And, since modelChanged is only actually sent once per frame, there is no 
point in you handling the invalidation; it already does this for you.  So, 
setValue could run 50 million times, and all Views associated with that 
dataProvider are only updated once per frame.

If you are not using editField, and are accessing the dataProvider array 
directly, then yes, you have to manually call modelChanged.  Of course, even 
if you call it once or 50 billion times, it still only gets updated visually 
once.


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


Thanks Jesse.

What do you mean by make the events bubble?  I know I can do
listOwner.dispatchEvent - it's what I'm doing now - but is there a better
way than accessing the listOwner?  By better I mean accessing the
listOwner's method feels wrong somehow ...

I tried using editField but it causes all items in the list to get
updated, or at least all cellrenderers get their setValue called.
Instead, I'm accessing
listOwner.getItemAt(getCellIndex().itemIndex)[getDataLabel()] to write
values.  Then I'm triggering the change event through dispatchEvent.  That
works and avoids the multiple calls to setValue.

Do you see any issues with that?


Derek Vadneau

----- Original Message ----- 
From: "JesterXL" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Wednesday, January 25, 2006 2:15 PM
Subject: Re: [Flashcoders] Cellrenderer confirmation


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);


_______________________________________________
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