|
The real way to do it is make your itemRenderer a
component. Follow the invalidation rules.
- make a flag, make it dirty when data truly
changes
- call invalidateProperties
- in your commitProperties, if the flag is dirty,
do what you need to, and call invalidateSize if yo resized something, otherwise,
set the selected property
The problem is, I think checkbox already handles
this for its selected property, so you are only slightly improving the
problem.
I say delay the drawing like to 300 milliseconds;
that should still give you scroll updates, but not as fast as possible with
enough time for validatino to get a few draws in.
----- Original Message -----
From: Tim Hoff
Sent: Wednesday, July 19, 2006 11:07 PM
Subject: [flexcoders] Re: How do I reset itemRenderer inside
DataGrid when dataProvider is updated? Hi Ben, Sorry if I came off harshly. I don't think that this is a bug, but rather an opinion difference concerning usage. Every visible cell in a DataGrid is a unique instance of an itemRenderer that is destroyed and created or recycled every time the grid is rendered. In thinking about your use-case, my solution of resetting the CheckBox when the itemRenderer data is set would cause the check to clear every time the grid is redrawn (scroll included). Many times, the selected value of the CheckBox is contained in the dataProvider. This makes it easy to keep the appropriate state of the CheckBoxes maintained. A possible solution is to dispatch a custom event every time that the call is made to get data. In the itemRenderer listen for the event and clear the CheckBox. Here is an example that uses an eventListener (see FolowUpItemRenderer): http://www.cflex.net/showfiledetails.cfm?ChannelID=1&Object=File&objectID=443 You could easily modify the logic to listen for a custom event. As far as the data goes, it's up to you. If you don't plan on reusing your custom itemRenderer, you can get the data inside. But, I wouldn't think that this is best practice. In theory, the itemRenderer shouldn't know about the actual data source or parent. It should just receive the data that is passed into it by the parent. This maintains encapsulation and allows reusability. That being said, whatever works is sometimes the best solution. The example above doesn't use xml, but you can see what I'm referring to. If you have trouble using a qname for the dataField, you could cast your xml result to a collection that is bound to the DataGrid. If you did this, you could also add a planNumberSelected boolean field to the collection and solve your problem without using events. Or, pass a boolean field (set to false) with your data from the ser! ver. Bind the field to the selected property of the ComboBox and you're done. Since I don't know exactly what you are trying to do, these are all guesses. Just trying to give you ideas. Less Harsh,
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- [flexcoders] Re: How do I reset itemRenderer inside DataG... Tim Hoff
- Re: [flexcoders] Re: How do I reset itemRenderer ins... JesterXL
- [flexcoders] Re: How do I reset itemRenderer inside ... ben.clinkinbeard
- Re: [flexcoders] Re: How do I reset itemRenderer... Brendan Meutzner
- Re: [flexcoders] Re: How do I reset itemRend... Brendan Meutzner

