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 server.  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,
-TH


--- In [email protected], "ben.clinkinbeard" <[EMAIL PROTECTED]> wrote:
>
> Hi Tim,
>
> The part I was referring to as 'dirty and hackish' was having to check
> to see if the data was actually new, due to the fact that the
> event/method fires whenever a row is scrolled in or out of view. I can
> only assume this is a bug and will attempt to report it as such unless
> someone informs me otherwise.
>
> As for your suggestion about passing in the data from the parent, I am
> certainly open to suggestions. Can you explain a bit further or show a
> brief example?
>
> Thanks,
> Ben
>
> --- In [email protected], "Tim Hoff" TimHoff@ wrote:
> >
> > Not at all. Overriding the set data function is commonly used.
> > What feels dirty and hackish to me, is getting the data inside of
> > the itemRenderer instead of passing it in from the parent. .02 :)
> >
> > -TH
>

__._,_.___

--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to