jayron
jayron

Reputation: 69

Flex 4 spark datagrid selected row change with tab

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.

Upvotes: 0

Views: 681

Answers (1)

Fixticks
Fixticks

Reputation: 41

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.

Upvotes: 1

Related Questions