0

I'm trying to change the selected row in a spark data grid when tabbing passed the last column. In other words, I'd like to highlighted row to follow the active cell.

Any ideas?

Thank You.

zero323
  • 322,348
  • 103
  • 959
  • 935
jayron
  • 69
  • 7
  • Do you want just to change the active row using Tab or should each Cell in a row be visited using Tab and after visiting the last one in a row the first cell of the next row should be selected? – Anton Apr 06 '13 at 21:02
  • Change the active row with Tab. Like the default behavior found in the MX datagrid. – jayron Apr 06 '13 at 21:10
  • Here is a good example http://squaredi.blogspot.de/2011/09/precision-focus-control-within-spark.html – Anton Apr 06 '13 at 23:27
  • This helps. Although it feels like going on a cruise to buy a wrist watch. Many thanks! – jayron Apr 07 '13 at 00:10
  • I have tried to extract only the code you need, but I can't do it. If you get it done, please answer your question here. – Anton Apr 07 '13 at 07:35
  • If reference to the before mentioned example (http://squaredi.blogspot.de/2011/09/precision-focus-control-within-spark.html) I believe i have found the code responsible for changing the active row by tabbing passed the last column in a row. Within ISDGAccessorFocus.as. "function setTargetEditableCell(editableItemPosition:IEditedItemPositionVO):void" – jayron Apr 07 '13 at 21:51

1 Answers1

1

Here's how i went about it. I have my selectionChange and caretChange events on the grid doing the same function.

<s:DataGrid id="my_rates_grid" x="0" y="0" width="100%" height="100%"
                            creationComplete="my_rates_grid_creationCompleteHandler(event)"
                            editable="true" alternatingRowColors="[#FFFFFF, #e9f1f6]"
                            gridItemEditorSessionSave="my_rates_grid_gridItemEditorSessionSaveHandler(event)"
                            requestedRowCount="4"
                            selectionChange="my_rates_grid_selectionChangeHandler(event)"
                            caretChange="my_rates_grid_selectionChangeHandler(event)">

Then in that my_rates_grid_selectionChangeHandler function (note i had to change its param type to generic type Event)

protected function my_rates_grid_selectionChangeHandler(event:Event):void
        {
            if(my_rates_grid.editorRowIndex >= 0){
                trace("it's happening");
                my_rates_grid.setSelectedIndex(my_rates_grid.editorRowIndex);
            }


        }

so everytime i tabbed it would follow and the save feature captures my new values as well.

Fixticks
  • 41
  • 4