Use DataGrid_witStyle at flexdiary.blogspot.com.  This sort of thing is exactly 
why I wrote it.  Check out the itemRenderer example I provided if you need to 
use style properties that don't exist in your itemRenderer's base class.

Note that at least part of your problem is coming from the fact that you're 
doing the set style in set data() rather than in an override of 
updateDisplayList().  Reread the docs on the component life cycle, and check 
out Alex and Gordon's article on that topic in Flex Authority.  I think you can 
still get the issue as a download, though you may have to pay for it.  What it 
will save you in learning curve will be well worth it.

HTH;

Amy

--- In [email protected], "shameer.forflex" <shameer.forf...@...> 
wrote:
>
> Hi All,
> I am facing a problem in using item renderers. I have a checkbox as an item 
> renderer in a datagrid. When I check/uncheck the checkbox, the color of the 
> checkbox should change from its default color to yellow. And on click of a 
> save button, I am saving the changes to the database and refreshes the grid. 
> But what happens then is,due to the recycling of renderers, the yellow 
> checkbox is appearing on some other row/column. I know that this happens 
> because I am not resetting the yellow to default color. I also don't know 
> where to reset the yellow to default color.
> 
> 
> This is what I did,..
> on click of check box, in the click handler, i set the yellow color 
> setStyle('fillColors',['#eccd12', '#e9d76c','#eccd12', '#e9d76c']);
> setStyle('fillAlphas',['1','1','1','1']);
> 
> also set a boolean variable isEdited to true
> 
> In override public function set data():void
> {
> if(isEdited)
> {
> //set yellow
>    setStyle('fillColors',['#eccd12', '#e9d76c','#eccd12', '#e9d76c']);
>    setStyle('fillAlphas',['1','1','1','1']);
> }
> else
> {
> //set default color
>    setStyle('fillColors',['#FFFFFF', '#CCCCCC','#FFFFFF', '#EEEEEE']);
>    setStyle('fillAlphas',['0.6','0.4','0.75','0.65']);
> }
> }
> 
> This doesnt solve the problem.
> 
> Can someone please help me in this?
> 
> Thanks
> Shameer
>


Reply via email to