--- In flexcoders@yahoogroups.com, "Glenn Jones" <[EMAIL PROTECTED]> wrote: > > I'm having a problem with red borders drawn around a cell in the DataGrid. > > I have a custom itemRenderer which extends HBox and impements > IDropInListItenRenderer > > In the set data() method, I set errorString based on conditions in the data. > The errorString is either set to null or a non-blank string. > In the same set data() method, I also call the super class > invalidateProperties and invalidateDisplayList methods. > > For reasons, I don't understand teh parent HBox class does not draw the > border when the borderColor is set to errorColor. So I modified > the updateDisplayList() method of my custom renderer to say - if ( > getStyle("borderColor") == getStyle("errorColor") ) then draw a border > myself using the errorColor (defaults to red). > > So far so good. > > But I have two problem symptoms: > > 1. If I correct the error in the underlying data, the red border remains > around the cell even though I've verified that my code is NOT drawing > it, and the "borderColor" style is no longer "red" > > 2. If I start scrolling around in the grid, other cells without errors are > getting a red border. > > I understand that the grid recycles instances of itemRenderers for > performance reasons, so I suspect that fixing root cause of #1 will fix #2. > But I'm at a loss as to what to do about #1.
Probably the simplest way to handle this is when you set data() if your error string is "" then you call graphics.clear() and invalidateDisplayList(). HTH; Amy