On 6/28/05, Pradeep Chaudhary <[EMAIL PROTECTED]> wrote:

> Can u suggest some ideas on how i can achieve that. How can i set a
> current row ? Does datagrid has some internal logic to identify the
> current row ?

By current row I mean the currently selected row.  I just realised
that the selection does not move with the focus, so I wrote some code
to move the selection programmatically every time the focus moves to a
new row.

<?xml version="1.0" encoding="iso-8859-1" ?> 
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
  <mx:Script>
    import mx.controls.DataGrid;

    function setSelectionToMe(event):Void
    {
      event.target.selectedIndex = event.itemIndex;
      doLater(this, "setFocusToMe",
          [event.target, event.columnIndex, event.itemIndex])
    }
    function setFocusToMe(dataGrid:DataGrid, columnIndex:Number,
        itemIndex:Number):Void
    {
      dataGrid.focusedCell = {columnIndex: columnIndex, itemIndex: itemIndex};
    }
  </mx:Script>
  <mx:DataGrid editable="true"
    cellFocusIn="setSelectionToMe(event)">
    <mx:dataProvider>
      <mx:Array>
        <mx:Object name="foo" value="1" />
        <mx:Object name="bar" value="2" />
      </mx:Array>
    </mx:dataProvider>
  </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