<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Formatting a Flex DataGrid control using a custom item renderer</title>
	<atom:link href="http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Fri, 19 Mar 2010 20:35:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: rt</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-7231</link>
		<dc:creator>rt</dc:creator>
		<pubDate>Fri, 12 Mar 2010 02:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-7231</guid>
		<description>This is a good example but ItemRenderer works only with small amount of data. If you have a huge advanceddatagrid like say 50 columns and 1500 rows and you try to use an itemRenderer on it , your application will be really slow when you try to scroll horizontally or vertically. I had a similar advanced datagrid where I used itemrenderer and setStyle to show +ve numbers in blue and -ve numbers in red and it runs very slow.Let me know if you have a better solution to this problem or make it run faster. Try it when the data is getting updated every 10 seconds</description>
		<content:encoded><![CDATA[<p>This is a good example but ItemRenderer works only with small amount of data. If you have a huge advanceddatagrid like say 50 columns and 1500 rows and you try to use an itemRenderer on it , your application will be really slow when you try to scroll horizontally or vertically. I had a similar advanced datagrid where I used itemrenderer and setStyle to show +ve numbers in blue and -ve numbers in red and it runs very slow.Let me know if you have a better solution to this problem or make it run faster. Try it when the data is getting updated every 10 seconds</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-6706</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 30 Dec 2009 18:56:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-6706</guid>
		<description>Great example, yet again you saved the day for me.</description>
		<content:encoded><![CDATA[<p>Great example, yet again you saved the day for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sss4</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5804</link>
		<dc:creator>sss4</dc:creator>
		<pubDate>Thu, 17 Sep 2009 05:42:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5804</guid>
		<description>Never mind, I got it:
        &lt;pre lang=&quot;mxml&quot;&gt;private function cur_labelFunc(item:Object, column:DataGridColumn):String {
                return cF.format(item[column.dataField]);
            }&lt;/pre&gt;
See any problems with that?

Thanks again,

~S</description>
		<content:encoded><![CDATA[<p>Never mind, I got it:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">private function cur_labelFunc(item:Object, column:DataGridColumn):String {
                return cF.format(item[column.dataField]);
            }</pre></div></div>

<p>See any problems with that?</p>
<p>Thanks again,</p>
<p>~S</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sss4</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5803</link>
		<dc:creator>sss4</dc:creator>
		<pubDate>Thu, 17 Sep 2009 04:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5803</guid>
		<description>Thanks for the awesome example, I think the fact that you&#039;re still getting comments on a  two year old post speaks to the usefulness of it.

I have multiple columns that I need to run through a label function, can you think of a quick way to make the label function re-usable?

TIA, 

~S</description>
		<content:encoded><![CDATA[<p>Thanks for the awesome example, I think the fact that you&#8217;re still getting comments on a  two year old post speaks to the usefulness of it.</p>
<p>I have multiple columns that I need to run through a label function, can you think of a quick way to make the label function re-usable?</p>
<p>TIA, </p>
<p>~S</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Rodriguez</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5566</link>
		<dc:creator>Javier Rodriguez</dc:creator>
		<pubDate>Fri, 04 Sep 2009 11:02:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5566</guid>
		<description>Hi , i was wondering where the listData object comes from?

Thanks in advance for your help</description>
		<content:encoded><![CDATA[<p>Hi , i was wondering where the listData object comes from?</p>
<p>Thanks in advance for your help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Rodriguez</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5565</link>
		<dc:creator>Javier Rodriguez</dc:creator>
		<pubDate>Fri, 04 Sep 2009 10:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5565</guid>
		<description>I would like to know if I could pass some objects to the constructor of the customItemRender class because I wasnt able to do it, the compiler throws an error. I attach my code below:
customItemRender class:
&lt;code&gt;
package core {
  import mx.containers.VBox;
  import mx.controls.TextInput;
  
  public class customItemRender extends VBox {
    public function customItemRender(_TextInput:TextInput, _TextInput2:TextInput){ 
    //TODO: implement function 
    super.addChild(_TextInput); 
    super.addChild(_TextInput2);
    }
  }
}
&lt;/code&gt;

Actionscript code for creating an AdvancedDataGrid itemRender:
&lt;code&gt;
AdvancedDataGridColumn.itemRenderer = new ClassFactory(customItemRender(_TextInput1,_TextInput2));
&lt;/code&gt;

Thanks in advance for your help,

Regards Javier</description>
		<content:encoded><![CDATA[<p>I would like to know if I could pass some objects to the constructor of the customItemRender class because I wasnt able to do it, the compiler throws an error. I attach my code below:<br />
customItemRender class:<br />
<code><br />
package core {<br />
  import mx.containers.VBox;<br />
  import mx.controls.TextInput;</p>
<p>  public class customItemRender extends VBox {<br />
    public function customItemRender(_TextInput:TextInput, _TextInput2:TextInput){<br />
    //TODO: implement function<br />
    super.addChild(_TextInput);<br />
    super.addChild(_TextInput2);<br />
    }<br />
  }<br />
}<br />
</code></p>
<p>Actionscript code for creating an AdvancedDataGrid itemRender:<br />
<code><br />
AdvancedDataGridColumn.itemRenderer = new ClassFactory(customItemRender(_TextInput1,_TextInput2));<br />
</code></p>
<p>Thanks in advance for your help,</p>
<p>Regards Javier</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niladri</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5332</link>
		<dc:creator>Niladri</dc:creator>
		<pubDate>Mon, 24 Aug 2009 13:20:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5332</guid>
		<description>Peter, I have one doubt.I&#039;m allocating data field for the data grid column dynamically. So some time it will not have data field as col1,may be some time it will have column field as col3 or col4.So my question is instead of referring data field in PriceLabel.as can I use the column id of those two column in PriceLabel.as</description>
		<content:encoded><![CDATA[<p>Peter, I have one doubt.I&#8217;m allocating data field for the data grid column dynamically. So some time it will not have data field as col1,may be some time it will have column field as col3 or col4.So my question is instead of referring data field in PriceLabel.as can I use the column id of those two column in PriceLabel.as</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niladri</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5284</link>
		<dc:creator>Niladri</dc:creator>
		<pubDate>Fri, 21 Aug 2009 19:37:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5284</guid>
		<description>Thanks a lot Peter.</description>
		<content:encoded><![CDATA[<p>Thanks a lot Peter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5281</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Fri, 21 Aug 2009 14:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5281</guid>
		<description>@Niladri,

Try something like this:
&lt;pre lang=&quot;mxml&quot;&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/ --&gt;
&lt;mx:Application name=&quot;DataGridColumn_itemRenderer_test&quot;
        xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.utils.ObjectUtil;

            private function col1_sortCompareFunc(itemA:Object, itemB:Object):int {
                return ObjectUtil.numericCompare(itemA.@col1, itemB.@col1);
            }

            private function col2_sortCompareFunc(itemA:Object, itemB:Object):int {
                return ObjectUtil.numericCompare(itemA.@col2, itemB.@col2);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XML id=&quot;itemsXML&quot;&gt;
        &lt;items&gt;
            &lt;item name=&quot;Item 1&quot; col1=&quot;1&quot; col2=&quot;0&quot; /&gt;
            &lt;item name=&quot;Item 2&quot; col1=&quot;0&quot; col2=&quot;1&quot; /&gt;
            &lt;item name=&quot;Item 3&quot; col1=&quot;0&quot; col2=&quot;0&quot; /&gt;
            &lt;item name=&quot;Item 4&quot; col1=&quot;-4&quot; col2=&quot;44&quot; /&gt;
            &lt;item name=&quot;Item 4&quot; col1=&quot;44&quot; col2=&quot;-4&quot; /&gt;
            &lt;item name=&quot;Item 4&quot; col1=&quot;2&quot; col2=&quot;111&quot; /&gt;
            &lt;item name=&quot;Item 4&quot; col1=&quot;2&quot; col2=&quot;1&quot; /&gt;
            &lt;item name=&quot;Item 4&quot; col1=&quot;1&quot; col2=&quot;222&quot; /&gt;
        &lt;/items&gt;
    &lt;/mx:XML&gt;

    &lt;mx:DataGrid id=&quot;dataGrid&quot;
            dataProvider=&quot;{itemsXML.item}&quot;
            rowCount=&quot;{dataGrid.dataProvider.length}&quot;&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField=&quot;@name&quot;
                    headerText=&quot;Name:&quot; /&gt;

            &lt;mx:DataGridColumn dataField=&quot;@col1&quot;
                    headerText=&quot;Col1:&quot;
                    sortCompareFunction=&quot;col1_sortCompareFunc&quot;
                    itemRenderer=&quot;PriceLabel&quot; /&gt;

            &lt;mx:DataGridColumn dataField=&quot;@col2&quot;
                    headerText=&quot;Col2:&quot;
                    sortCompareFunction=&quot;col2_sortCompareFunc&quot;
                    itemRenderer=&quot;PriceLabel&quot; /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
&lt;/pre&gt;

And the custom item renderer, &lt;em&gt;PriceLabel.as&lt;/em&gt;, is as follows:
&lt;pre lang=&quot;actionscript3&quot;&gt;
/** http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/ */
package {
    import mx.controls.Label;
    import mx.controls.listClasses.*;

    public class PriceLabel extends Label {

        private const POSITIVE_COLOR:uint = 0x000000; // Black
        private const NEGATIVE_COLOR:uint = 0xFF0000; // Red

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);

            /* Set the font color based on the item price. */
            setStyle(&quot;color&quot;, (parseFloat(data.@col1) &lt; parseFloat(data.@col2)) ? NEGATIVE_COLOR : POSITIVE_COLOR);
        }
    }
}
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p>@Niladri,</p>
<p>Try something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;DataGridColumn_itemRenderer_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.utils.ObjectUtil;</span>
&nbsp;
<span style="color: #339933;">            private function col1_sortCompareFunc(itemA:Object, itemB:Object):int {</span>
<span style="color: #339933;">                return ObjectUtil.numericCompare(itemA.@col1, itemB.@col1);</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function col2_sortCompareFunc(itemA:Object, itemB:Object):int {</span>
<span style="color: #339933;">                return ObjectUtil.numericCompare(itemA.@col2, itemB.@col2);</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:XML</span> id=<span style="color: #ff0000;">&quot;itemsXML&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;">&lt;items<span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 1&quot;</span> col1=<span style="color: #ff0000;">&quot;1&quot;</span> col2=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 2&quot;</span> col1=<span style="color: #ff0000;">&quot;0&quot;</span> col2=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 3&quot;</span> col1=<span style="color: #ff0000;">&quot;0&quot;</span> col2=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 4&quot;</span> col1=<span style="color: #ff0000;">&quot;-4&quot;</span> col2=<span style="color: #ff0000;">&quot;44&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 4&quot;</span> col1=<span style="color: #ff0000;">&quot;44&quot;</span> col2=<span style="color: #ff0000;">&quot;-4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 4&quot;</span> col1=<span style="color: #ff0000;">&quot;2&quot;</span> col2=<span style="color: #ff0000;">&quot;111&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 4&quot;</span> col1=<span style="color: #ff0000;">&quot;2&quot;</span> col2=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;">&lt;item name=<span style="color: #ff0000;">&quot;Item 4&quot;</span> col1=<span style="color: #ff0000;">&quot;1&quot;</span> col2=<span style="color: #ff0000;">&quot;222&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;">&lt;/items<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:XML</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> id=<span style="color: #ff0000;">&quot;dataGrid&quot;</span></span>
<span style="color: #000000;">            dataProvider=<span style="color: #ff0000;">&quot;{itemsXML.item}&quot;</span></span>
<span style="color: #000000;">            rowCount=<span style="color: #ff0000;">&quot;{dataGrid.dataProvider.length}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;@name&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Name:&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;@col1&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Col1:&quot;</span></span>
<span style="color: #000000;">                    sortCompareFunction=<span style="color: #ff0000;">&quot;col1_sortCompareFunc&quot;</span></span>
<span style="color: #000000;">                    itemRenderer=<span style="color: #ff0000;">&quot;PriceLabel&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGridColumn</span> dataField=<span style="color: #ff0000;">&quot;@col2&quot;</span></span>
<span style="color: #000000;">                    headerText=<span style="color: #ff0000;">&quot;Col2:&quot;</span></span>
<span style="color: #000000;">                    sortCompareFunction=<span style="color: #ff0000;">&quot;col2_sortCompareFunc&quot;</span></span>
<span style="color: #000000;">                    itemRenderer=<span style="color: #ff0000;">&quot;PriceLabel&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:columns</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:DataGrid</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>And the custom item renderer, <em>PriceLabel.as</em>, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/** http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/ */</span>
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.Label;
    <span style="color: #0033ff; font-weight: bold;">import</span> mx.controls.listClasses.<span style="color: #000000; font-weight: bold;">*</span>;
&nbsp;
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> PriceLabel extends Label <span style="color: #000000;">&#123;</span>
&nbsp;
        <span style="color: #0033ff; font-weight: bold;">private</span> const POSITIVE_COLOR<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = 0x000000; <span style="color: #009900;">// Black</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> const NEGATIVE_COLOR<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = 0xFF0000; <span style="color: #009900;">// Red</span>
&nbsp;
        override <span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>, unscaledHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">super</span>.updateDisplayList<span style="color: #000000;">&#40;</span>unscaledWidth, unscaledHeight<span style="color: #000000;">&#41;</span>;
&nbsp;
            <span style="color: #3f5fbf;">/* Set the font color based on the item price. */</span>
            <span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;color&quot;</span>, <span style="color: #000000;">&#40;</span><span style="color: #004993;">parseFloat</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span>.@col1<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #004993;">parseFloat</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">data</span>.@col2<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">?</span> NEGATIVE_COLOR <span style="color: #000000; font-weight: bold;">:</span> POSITIVE_COLOR<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niladri</title>
		<link>http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/comment-page-1/#comment-5279</link>
		<dc:creator>Niladri</dc:creator>
		<pubDate>Fri, 21 Aug 2009 09:59:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/#comment-5279</guid>
		<description>Hi peterd
Instead of comparing the data value with 0, If i want to do comparison of two column value and set the row value red if column1 value is less than column2 value then how can i do?</description>
		<content:encoded><![CDATA[<p>Hi peterd<br />
Instead of comparing the data value with 0, If i want to do comparison of two column value and set the row value red if column1 value is less than column2 value then how can i do?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
