|
Hi Tony, This is going to be in my Using XML Data Quick Start but isn't due to go live for a few weeks so here it is in hopes that you won't lose as much hair as I did -- hot off the draft: // Delete selected book private function deleteBookHandler():void { // Save the currently selected index var selectedBookIndex:int = myDataGrid.selectedIndex; // Delete the currently-selected book delete (myBooks.book[selectedBookIndex]); // Reselect the next logical item in the data grid newSelectedIndex = (selectedBookIndex==0) ? 0 : selectedBookIndex - 1; // Change the selected index of the data grid // at a later frame. See note on changeDataGridIndex() // method for more details on this workaround. callLater ( changeDataGridIndex ); } // This is a workaround for a known issue with // List-based components where deleting an item // from the control's dataProvider leaves the // selectedIndex at an incorrect value. The workaround // is to reassign the data provider at least a // frame later and to change the index there. private function changeDataGridIndex ():void { // Reassign the data grid's data provider myDataGrid.dataProvider = myBooks.book; // Set the selected index myDataGrid.selectedIndex = newSelectedIndex; // Validate the form to make sure that there // is actually a selection (that the grid is // not empty.) validateForm(); }
__._,_.___
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
__,_._,___ |
- Re: [flexcoders] focus new row? Aral Balkan
- [flexcoders] Re: focus new row? tonyx_788
- [flexcoders] Re: focus new row? tonyx_788

