I started with the example from your blog dated Feb 2008 (CheckBoxListAndDataGrid).
To deselect the other rows, the checkbox column header renderer calls a 'selectAll()' method on the CheckBoxDataGrid with a flag of false. That method builds two arrays - one for all items in the collection and one for all indices in the collection. It then replaces mx:DataGrid.selectedItems and selectedIndices with new arrays. In the deselect case, the new arrays are empty. In the select all case then have all items/indices. Visually, selectAll true/false seems to work when it's called. But in the use-case I describe below I'm counting on the mx:DataGrid.selectItem() to be called in order to deselect rows in the case that a single row is selected. Based on trace statements, I know that mx:DataGrid.selectItem() is never called when the problem occurs Is there something about the way I'm selecting things which causes the selectItem() to not be called? I tried replacing just selectedItemds or just selectedIndicies or both. it doesn't seem. Thanks, Glenn On Fri, Jan 9, 2009 at 1:11 AM, Alex Harui <aha...@adobe.com> wrote: > Which example did you start with? Which event do you use to deselect > the other rows, and what does that code look like? > > > > *From:* flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] *On > Behalf Of *Glenn Jones > *Sent:* Thursday, January 08, 2009 9:49 PM > *To:* flexcoders@yahoogroups.com > *Subject:* [flexcoders] DataGrid selectAll problem > > > > Hi, > > I'm using Flex 3.2 and I have a DataGrid which implements a column of > checkboxes to select rows. I started with Alex' example. > Then I added a header renderer on the checkbox column such that if check > the header, then all rows are selected. > To implement the select all behavior, I'm creating an array of indices for > [0..n] and assigning that array to mx:DataGrid.selectedIndices. > > For the most part this works fine. > > But if the DataGrid is editable, then I sometimes have a problem. The > problem is that if all rows are selected, and you click on > an editable cell, sometimes the cell becomes editable without deselecting > all of the other rows. The behavior I want is that > if you start editing a cell, then just that row becomes selected. This > happens some of time, but not all of the time. > > If the grid is non-editable, then I can't reproduce the problem. > > I overrode mx:DataGrid.selectItem() in order to clear the checkbox in the > header renderer any time a single item is selected. I've > noticed that when the problem behavior occurs, the mx:DataGrid.selectItem() > method is never called. > > It's almost like there's some race condition between selecting an item and > starting a cell edit. > > Any ideas on how I could work around this? > > Thanks, > Glenn > > >