Hi,

 

I am using a cellRenderer in my datagrid. Now when I sort by clicking on header the DatagridColumns on which I have cellRenderer never cleans up the cell which was rendered by cellRenderer. How can I solve this issue? Files and screen Image below.

<!—Application à

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

<mx:DataGrid id="myGrid" width="350" height="100">

            <mx:columns>

                <mx:Array>

                    <mx:DataGridColumn columnName="Artist"/>

                    <mx:DataGridColumn columnName="Price" cellRenderer="SimpleCustomCellRenderer"/>

                    <mx:DataGridColumn columnName="Album" />

                </mx:Array>

            </mx:columns>

 

                <mx:dataProvider>

                    <mx:Array id="arr">

                        <mx:Object Artist=" Kapil" Album="All Time Favourites" Price="101"/>

                        <mx:Object Artist=" Kapil" Album="Classic Songs" Price="10"/>

                    </mx:Array>

                </mx:dataProvider>

 

            </mx:DataGrid>

</mx:Application>

 

<!—CellRendererà

<mx:TextInput xmlns:mx="http://www.macromedia.com/2003/mxml"

borderStyle="none" backgroundAlpha="0">

    <mx:Script>

        function setValue(str, item, sel)

        {          

            text = String(item.Price);

            var price:Number = Number(text);

            if(price > 100)

            {

               setCellBackgroundColor(0x00FF00, 100);

            }

            else if(price > 1000)

            {

                setCellBackgroundColor(0x00FF00, 100);

            }

        }

       

        function setCellBackgroundColor(newColor, newAlpha)

        {

            

             setStyle("backgroundAlpha", newAlpha==undefined ? 0 :newAlpha);

             setStyle("backgroundColor", newColor);

        }

    </mx:Script>

</mx:TextInput>

 

 

After Sorting on Price

 

 

Thanks,

 

Shahn

 

 



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to