0
votes

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.

1
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
Change the active row with Tab. Like the default behavior found in the MX datagrid.jayron
Here is a good example squaredi.blogspot.de/2011/09/…Anton
This helps. Although it feels like going on a cruise to buy a wrist watch. Many thanks!jayron
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

1 Answers

1
votes

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.