Flexcoders-
  I have a datgrid where a user can enter a number in a field. After
the user enters the number, I would like the same row to stay selected
and the cell to be completely out of focus (just like when a row is
normally selected). I have tried setting the
datagrid.focusedCell=undefined and the dg.cellEditor = undefined and
that does not work. here's an example of my code. In the 2nd column,
if you enter any text and hit return, the same row is still selected
but the cell is still in edit mode. If you hit the "Escape" key, the
row is out of focus which is exactly what I want. My question is how
does one replicate that? I couldn't find any docs anywhere on this
forum or google.

Thanks for any help!

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"; xmlns="*">

<mx:Script>
<![CDATA[

var dp = [  { one:"one", two:"two", three:"three" },
                { one:"four", two:"five", three:"six" },
                  { one:"seven", two:"eight", three:"nine" }];

function cellEditHandler(event:Object) : Void
{
        var selecteditem =
event.target.dataProvider.getItemAt(event.itemIndex);                   
        event.target.focusedCell = {itemIndex:event.itemIndex-1,
columnIndex:event.columnIndex};
}          

]]>
</mx:Script>

<mx:DataGrid id="dg" dataProvider="{ dp }"  editable="true"
cellEdit="cellEditHandler(event)">
<mx:columns>
<mx:Array>
        <mx:DataGridColumn columnName="one" editable="false"/>
        <mx:DataGridColumn columnName="two" />
        <mx:DataGridColumn columnName="three" editable="false"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
</mx:Application>





--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to