<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; itemEditor</title>
	<atom:link href="http://blog.flexexamples.com/tag/itemeditor/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using a NumericStepper control as an item editor for a DataGrid control in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/#comments</comments>
		<pubDate>Tue, 13 May 2008 06:54:26 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[NumericStepper]]></category>
		<category><![CDATA[editable]]></category>
		<category><![CDATA[editorDataField]]></category>
		<category><![CDATA[itemEditor]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can use a NumericStepper as an item editor for a Flex DataGrid control by setting the itemEditor and editorDataField properties on the DataGridColumn object.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ArrayCollection id="arrColl"&#62; &#60;mx:source&#62; &#60;mx:Array&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use a NumericStepper as an item editor for a Flex DataGrid control by setting the <code>itemEditor</code> and <code>editorDataField</code> properties on the DataGridColumn object.</p>
<p>Full code after the jump.</p>
<p><span id="more-627"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="Student A" score="8" /&gt;
                &lt;mx:Object label="Student B" score="4" /&gt;
                &lt;mx:Object label="Student C" score="7" /&gt;
                &lt;mx:Object label="Student D" score="8" /&gt;
                &lt;mx:Object label="Student E" score="2" /&gt;
                &lt;mx:Object label="Student F" score="6" /&gt;
                &lt;mx:Object label="Student G" score="7" /&gt;
                &lt;mx:Object label="Student H" score="7" /&gt;
                &lt;mx:Object label="Student I" score="9" /&gt;
                &lt;mx:Object label="Student J" score="8" /&gt;
                &lt;mx:Object label="Student K" score="4" /&gt;
                &lt;mx:Object label="Student L" score="7" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            editable="true"
            rowCount="8"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label"
                    editable="false" /&gt;
            &lt;mx:DataGridColumn dataField="score"
                    editable="true"
                    itemEditor="mx.controls.NumericStepper"
                    editorDataField="value" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test/bin/main.html" width="100%" height="300"></iframe></p>
<p class="new">UPDATE: But what if you want to change the properties (such as <code>minimum</code> and <code>maximum</code>) or styles on the NumericStepper item editor? One method is to create a custom component which extends the NumericStepper and override the properties and default styles.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test_2/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="Student A" score="81" /&gt;
                &lt;mx:Object label="Student B" score="42" /&gt;
                &lt;mx:Object label="Student C" score="75" /&gt;
                &lt;mx:Object label="Student D" score="84" /&gt;
                &lt;mx:Object label="Student E" score="24" /&gt;
                &lt;mx:Object label="Student F" score="62" /&gt;
                &lt;mx:Object label="Student G" score="71" /&gt;
                &lt;mx:Object label="Student H" score="77" /&gt;
                &lt;mx:Object label="Student I" score="91" /&gt;
                &lt;mx:Object label="Student J" score="88" /&gt;
                &lt;mx:Object label="Student K" score="44" /&gt;
                &lt;mx:Object label="Student L" score="72" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            editable="true"
            rowCount="8"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label"
                    editable="false" /&gt;
            &lt;mx:DataGridColumn dataField="score"
                    editable="true"
                    itemEditor="comps.MyNumericStepper"
                    editorDataField="value" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test_2/bin/srcview/source/comps/MyNumericStepper.mxml.html">comps/MyNumericStepper.mxml</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/ --&gt;
&lt;mx:NumericStepper xmlns:mx="http://www.adobe.com/2006/mxml"
        minimum="0"
        maximum="100"
        cornerRadius="0"&gt;

&lt;/mx:NumericStepper&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test_2/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_NumericStepper_test_2/bin/main.html" width="100%" height="300"></iframe></p>
<p class="new">You could also define the item renderer using a ClassFactory, as seen in the following example:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.NumericStepper;

            [Bindable]
            private var numericStepperFac:ClassFactory;

            private function init():void {
                numericStepperFac = new ClassFactory(NumericStepper);
                numericStepperFac.properties = {minimum:0, maximum:100};
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="Student A" score="81" /&gt;
                &lt;mx:Object label="Student B" score="42" /&gt;
                &lt;mx:Object label="Student C" score="75" /&gt;
                &lt;mx:Object label="Student D" score="84" /&gt;
                &lt;mx:Object label="Student E" score="24" /&gt;
                &lt;mx:Object label="Student F" score="62" /&gt;
                &lt;mx:Object label="Student G" score="71" /&gt;
                &lt;mx:Object label="Student H" score="77" /&gt;
                &lt;mx:Object label="Student I" score="91" /&gt;
                &lt;mx:Object label="Student J" score="88" /&gt;
                &lt;mx:Object label="Student K" score="44" /&gt;
                &lt;mx:Object label="Student L" score="72" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            editable="true"
            rowCount="8"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label"
                    editable="false" /&gt;
            &lt;mx:DataGridColumn dataField="score"
                    editable="true"
                    itemEditor="{numericStepperFac}"
                    editorDataField="value" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p>Or, you could define an inline item editor using the following code:</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.NumericStepper;

            [Bindable]
            private var numericStepperFac:ClassFactory;

            private function init():void {
                numericStepperFac = new ClassFactory(NumericStepper);
                numericStepperFac.properties = {minimum:0, maximum:100};
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ArrayCollection id="arrColl"&gt;
        &lt;mx:source&gt;
            &lt;mx:Array&gt;
                &lt;mx:Object label="Student A" score="81" /&gt;
                &lt;mx:Object label="Student B" score="42" /&gt;
                &lt;mx:Object label="Student C" score="75" /&gt;
                &lt;mx:Object label="Student D" score="84" /&gt;
                &lt;mx:Object label="Student E" score="24" /&gt;
                &lt;mx:Object label="Student F" score="62" /&gt;
                &lt;mx:Object label="Student G" score="71" /&gt;
                &lt;mx:Object label="Student H" score="77" /&gt;
                &lt;mx:Object label="Student I" score="91" /&gt;
                &lt;mx:Object label="Student J" score="88" /&gt;
                &lt;mx:Object label="Student K" score="44" /&gt;
                &lt;mx:Object label="Student L" score="72" /&gt;
            &lt;/mx:Array&gt;
        &lt;/mx:source&gt;
    &lt;/mx:ArrayCollection&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{arrColl}"
            editable="true"
            rowCount="8"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn dataField="label"
                    editable="false" /&gt;
            &lt;mx:DataGridColumn dataField="score"
                    editable="true"
                    editorDataField="value"&gt;
                &lt;mx:itemEditor&gt;
                    &lt;mx:Component&gt;
                        &lt;mx:NumericStepper minimum="0" maximum="100" /&gt;
                    &lt;/mx:Component&gt;
                &lt;/mx:itemEditor&gt;
            &lt;/mx:DataGridColumn&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using a NumericStepper control as an item editor for a DataGrid control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/',contentID: 'post-627',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'editable,editorDataField,itemEditor',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/05/12/using-a-numericstepper-control-as-an-item-editor-for-a-datagrid-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using a Flex TextArea control as a drop-in item editor</title>
		<link>http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/</link>
		<comments>http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/#comments</comments>
		<pubDate>Mon, 01 Oct 2007 04:58:39 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[TextArea]]></category>
		<category><![CDATA[itemEditor]]></category>
		<category><![CDATA[variableRowHeight]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/</guid>
		<description><![CDATA[<p>User &#8220;Fred&#8221; <a href="http://blog.flexexamples.com/2007/07/23/creating-multi-line-data-grid-rows-with-variable-row-heights/#comment-3053">asked a question the other day</a> about using the TextArea as an item editor in an editable, variable line height DataGrid control.</p> <p>The following example shows how you can use the Flex TextArea control as a drop-in item editor to allow you to easily edit the items in a DataGrid control.</p> <p>Full [...]]]></description>
			<content:encoded><![CDATA[<p>User &#8220;Fred&#8221; <a href="http://blog.flexexamples.com/2007/07/23/creating-multi-line-data-grid-rows-with-variable-row-heights/#comment-3053">asked a question the other day</a> about using the TextArea as an item editor in an editable, variable line height DataGrid control.</p>
<p>The following example shows how you can use the Flex TextArea control as a drop-in item editor to allow you to easily edit the items in a DataGrid control.</p>
<p>Full code after the jump.</p>
<p><span id="more-216"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:XML id="itemsXML" source="data/items.xml" /&gt;

    &lt;mx:DataGrid id="dataGrid"
            dataProvider="{itemsXML.item}"
            variableRowHeight="true"
            editable="true"
            width="100%"
            height="100%"&gt;
        &lt;mx:columns&gt;
            &lt;mx:DataGridColumn id="idColumn"
                    dataField="@id"
                    editable="false"
                    headerText="ID" /&gt;
            &lt;mx:DataGridColumn id="descColumnTextInput"
                    dataField="@desc"
                    editable="true"
                    wordWrap="true"
                    headerText="Desc (TextInput)" /&gt;
            &lt;mx:DataGridColumn id="descColumnTextArea"
                    dataField="@desc"
                    editable="true"
                    wordWrap="true"
                    itemEditor="mx.controls.TextArea"
                    editorUsesEnterKey="true"
                    headerText="Desc (TextArea)" /&gt;
        &lt;/mx:columns&gt;
    &lt;/mx:DataGrid&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download">items.xml</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/ --&gt;
&lt;items&gt;
    &lt;item id="1" desc="The quick brown fox jumped over the lazy dog." /&gt;
    &lt;item id="2" desc="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." /&gt;
    &lt;item id="3" desc="Pellentesque nonummy aliquet metus." /&gt;
    &lt;item id="4" desc="Nullam enim." /&gt;
    &lt;item id="5" desc="Nullam sollicitudin sodales diam." /&gt;
    &lt;item id="6" desc="Praesent quis tellus vel erat tristique placerat." /&gt;
    &lt;item id="7" desc="Sed egestas, enim a convallis auctor, nisl tellus tincidunt nibh, vitae tempus mauris risus at arcu." /&gt;
    &lt;item id="8" desc="Suspendisse laoreet sem eget ipsum porta consequat." /&gt;
    &lt;item id="9" desc="Ut imperdiet felis quis orci." /&gt;
    &lt;item id="10" desc="Phasellus tempus ante eu nisl." /&gt;
    &lt;item id="11" desc="Donec velit sem, rutrum ac, bibendum sed, mattis ac, odio." /&gt;
    &lt;item id="12" desc="Fusce mauris turpis, vehicula nec, mattis et, dapibus quis, arcu." /&gt;
    &lt;item id="13" desc="Morbi tincidunt volutpat justo." /&gt;
    &lt;item id="14" desc="Nam urna." /&gt;
    &lt;item id="15" desc="Mauris est dui, aliquet at, venenatis tempus, eleifend a, pede." /&gt;
    &lt;item id="16" desc="Vestibulum porttitor arcu sit amet nulla." /&gt;
    &lt;item id="17" desc="Nulla vitae sapien." /&gt;
&lt;/items&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/DataGridColumn_itemEditor_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using a Flex TextArea control as a drop-in item editor on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/',contentID: 'post-216',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'itemEditor,variableRowHeight',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/09/30/using-a-flex-textarea-control-as-a-drop-in-item-editor/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

