Yea, I guess I didn't realize the impact of recycling on the disabled stuff. Thanks for pointing that out.
As for the columns, at least in my case (which in reality is a bit more complex than my description here) I will still need a fair amount of custom logic in the renderer. It also seems like you could avoid the custom columns by using the ClassFactory approach. Is there any reason to favor the column + renderer approach over the ClassFactory approach? As always, just trying to figure out the best/most efficient/"right" way to do things. Thanks, Ben --- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote: > > So the "hidden theory of item renderers" from my blog (hidden because I > did not specifically mention it) is that by pairing custom columns with > custom renderers you can get re-usability. The column would specify a > 'disabledField' and the renderer would pick it up and use it, although > in this case, you could just subclass CheckBox and add a disabledField > to it just like it already has selectedField. > > > > That should always be better than the external approach because in the > external approach you also will have to disable/enable the correct > renderers when they are recycled from a scroll, resize, sort, etc. > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of ben.clinkinbeard > Sent: Wednesday, November 21, 2007 12:07 PM > To: [email protected] > Subject: [flexcoders] Re: DataGrid.itemToItemRenderer()- what about > columns besides the first? > > > > Hi Alex, I think maybe I didn't explain myself well enough. The > CheckBox is rendering the "isSelected" property in my data items and > works correctly (displays checked or not) when scrolling and all that > (its basically your CenteredCheckBox class). The WebService then > updates the "status" property in my data items. When the status > property gets set to certain values, I need to disable the CheckBox. > > That is the main reason I went with the "external" approach. Would you > still recommend overriding the data setter in my renderer and having > it look at the status property to set its enabled state while using > the isSelected property to set its checked state? I keep feeling like > I need to create renderers that are generic and reusable, which in > turn necessitates some of this externalized behavior. Do you think it > would be better to just create specialized renderers that encapsulate > this complex behavior? > > Thanks, > Ben > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> > , "Alex Harui" <aharui@> wrote: > > > > The "theory of item renderers" states that all visual aspects of a > > renderer should be driven by the renderers data and external calls > from > > the renderer such as isItemSelected. No attempts should be made to > > manipulate the renderer from the outside because renderers get > recycled > > (see my blog articles for more info). I would expect that if you > > scrolled, you would find that the check marks end up on the wrong > > checkboxes because of recycling. If the web service updates the > > collection, that should cause the renderer to refresh and it should > > examine the field in the collection and set its checkmark > appropriately. > > Then the checkbox renderer can be at any column. itemToItemRenderer is > > there to handle some internal stuff and as a convenience for a few > > scenarios where you can get away with using it, but doesn't generalize > > well to datagrid because we don't have function overloading. > > > > > > > > ________________________________ > > > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> > ] On > > Behalf Of ben.clinkinbeard > > Sent: Wednesday, November 21, 2007 6:43 AM > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > > Subject: [flexcoders] Re: DataGrid.itemToItemRenderer()- what about > > columns besides the first? > > > > > > > > I don't think so but maybe you can tell me otherwise. I should also > > mention that this is mainly a hypothetical question as my current > > situation deals with a first column renderer. > > > > My current use of itemToItemRenderer() is to react to data updates > > that happen when a web service that is called on an interval returns. > > I have a DataGrid whose first column is a CheckBox. The call that is > > made on an interval updates the status field of my data items, which > > is displayed in another column. When an item is in certain statuses > > (various stages of "in progress") I need to disable the CheckBox so > > that no further action can be taken on the item. So currently I am > > catching the CollectionEvent, finding the affected items and then > > using itemToItemRenderer() to access and disable/enable the CheckBox. > > If the CheckBox were not in the first column, or I needed to update > > some other field, how would I go about that? Or would I just kinda be > > SOL? > > > > Thanks, > > Ben > > > > --- In [email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > , "Alex Harui" <aharui@> wrote: > > > > > > No public API. There are mx_internal ways, but is there no way for > you > > > to work from events and the renderers? > > > > > > > > > > > > ________________________________ > > > > > > From: [email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > [mailto:[email protected] > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > ] On > > > Behalf Of ben.clinkinbeard > > > Sent: Tuesday, November 20, 2007 8:19 PM > > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > Subject: [flexcoders] DataGrid.itemToItemRenderer()- what about > > columns > > > besides the first? > > > > > > > > > > > > Title pretty much sums it up, but what if I wanted to access an > > > itemRenderer that is not in the first column? Is there any way to do > > > that starting with nothing but the corresponding data item? > > > > > > Thanks, > > > Ben > > > > > >

