On 5/19/05, shettyaditsathish <[EMAIL PROTECTED]> wrote:
> i need to create a row in an existing datagrid on an event and show the
> the 1st column of the newly created row in editable mode.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
  xmlns="*">
  <mx:Script>
    function enterNewRow():Void
    {
      grid.addItem();
      focusNewRow();
      doLater(this, "focusNewRow");
    }
    function focusNewRow():Void
    {
      grid.setFocus();
      grid.focusedCell = {columnIndex: 0, itemIndex:
grid.dataProvider.length-1};
    }
  </mx:Script>
  <mx:DataGrid id="grid" editable="true">
    <mx:dataProvider>
      <mx:Array>
        <mx:Object name="manish" colour="red" />
        <mx:Object name="abdul" colour="blue" />
      </mx:Array>
    </mx:dataProvider>
  </mx:DataGrid>
  <mx:Button label="Enter New Row" click="enterNewRow()" />
</mx:Application>

Note:

 1.  grid.addItem() will add a blank row
 2.  call focusNewRow() in the next frame using doLater()


 
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