It's working! I think the key was to NOT use 'selected' as a property in the model, and I also added userList.invalidateList() before the section of code that sets all the CheckBoxes back to being deselected.
Thanks for all teh help! --- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > Ok, next thing to see is if collectionChange events fire when the values > are reset to false. > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Geoffrey > Sent: Wednesday, November 14, 2007 12:17 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Item Renderer Not Updating > > > > I need to correct my previous post with some changes I've made. > > I changed the model property to 'isSelected', and am binding that to > the 'selected' property of the CheckBox like so: > <mx:CheckBox id="myCheckBox" > selected="{data.isSelected}" > label="{data.label}" > x="0" y="0" > height="20" width="100%"/> > > Now if I set some of the values to true in the command class listed > below, it picks it up. So that is working, but if do the user gesture > that is suppose to reset all values to false, that doesn't happen > (even though the model is set correctly). > > Thanks for the help! > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > , "Geoffrey" <gtb104@> wrote: > > > > It's not picking it up. > > > > I did the following in my command class: > > for (var i:uint = 0; i < data.result.length; i++) { > > // Get the current result and create a ResourceItemModel from it > > userSummaryVO = UserSummaryVO(data.result[i]); > > item = new ResourceItemModel(); > > item.firstName = userSummaryVO.firstName; > > item.lastName = userSummaryVO.lastName; > > item.username = userSummaryVO.username; > > item.selected = true; > > > > // Add the item to the model > > __model.userSummaries.addItem(item); > > } > > > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <aharui@> wrote: > > > > > > Set some selected props to true before assigning the dp to see if > it is > > > picking it up. > > > > > > > > > > > > ________________________________ > > > > > > From: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > ] On > > > Behalf Of Geoffrey > > > Sent: Wednesday, November 14, 2007 9:27 AM > > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > > > > Subject: [flexcoders] Re: Item Renderer Not Updating > > > > > > > > > > > > I went and created a component as the itemRenderer, like this: > > > > > > ---------------- > > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> > > > <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > " > width="100%" > > > height="20"> > > > > > > <mx:CheckBox id="myCheckBox" > > > selectedField="selected" > > > label="{data.label}" > > > x="0" y="0" > > > height="20" width="100%"/> > > > > > > </mx:Canvas> > > > ---------------- > > > > > > As you can see I've set the selectedField property to "selected", > but > > > that still doesn't seem to effect anything. If some of the > CheckBoxes > > > are selected, and the user does the correct gesture, I have a loop > > > that sets the 'selected' property of the model to false. I expect > > > that to deselect all of the CheckBoxes. Yea.... not happening. > > > > > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > , "Alex Harui" <aharui@> wrote: > > > > > > > > Oh, maybe you need to set selectedField="selected" > > > > > > > > > > > > > > > > ________________________________ > > > > > > > > From: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > [mailto:flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > ] On > > > > Behalf Of Geoffrey > > > > Sent: Wednesday, November 14, 2007 8:37 AM > > > > To: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > > > > Subject: [flexcoders] Re: Item Renderer Not Updating > > > > > > > > > > > > > > > > The ResourceModel and ResourceItemModel classes are [Bindable]. Is > > > > that what you're talking about? > > > > > > > > Also, I was thinking that the 'selected' property of > ResourceItemModel > > > > is not used for the 'selected' property of the CheckBox in the > > > > itemRenderer. The 'label' property of the model seems to work, > but is > > > > 'selected' not the appropriate variable to use? Should it be > > > > something like 'data' perhapse? > > > > > > > > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > > <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <aharui@> > wrote: > > > > > > > > > > > > Unless the data object is [bindable], modifications to data > > > > objects must > > > > > > be accompanied by a call to itemUpdated on the collection. > > > > > > > > > > > > > > > > > > > > > > > > ________________________________ > > > > > > > > > > > > From: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > > <mailto:flexcoders%40yahoogroups.com> > > > > [mailto:flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > > ] On > > > > > > Behalf Of Geoffrey > > > > > > Sent: Tuesday, November 13, 2007 8:40 PM > > > > > > To: flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > > > > > > > > Subject: [flexcoders] Re: Item Renderer Not Updating > > > > > > > > > > > > > > > > > > > > > > > > I know there's got to be something simple that I'm > overlooking, > > > and > > > > I > > > > > > thought that I read > > > > > > something pertaining to this in the docs, but for the life > of me I > > > > can't > > > > > > find it. > > > > > > > > > > > > Thanks for any suggestions, > > > > > > Geoff > > > > > > > > > > > > --- In flexcoders@yahoogroups.com > <mailto:flexcoders%40yahoogroups.com> > > > <mailto:flexcoders%40yahoogroups.com> > > > > <mailto:flexcoders%40yahoogroups.com> > > > > <mailto:flexcoders%40yahoogroups.com> > > > > > > , "Geoffrey" <gtb104@> wrote: > > > > > > > > > > > > > > I have a List that is bound to an ArrayCollection. If I > > > > programaticly > > > > > > > update the ArrayCollection, the itemRenderer fails to > update as > > > > well. > > > > > > > > > > > > > > <mx:List id="userList" > > > > > > > dataProvider="{__resourceModel.userSummaries}" > > > > > > > selectable="false" > > > > > > > itemClick="onItemClick(event)" > > > > > > > itemRenderer="mx.controls.CheckBox" > > > > > > > width="100%" height="100%"/> > > > > > > > > > > > > > > > > > > > > > __resourceModel.userSummaries is an ArrayCollection of > > > > > > > ResourceItemModels which looks like: > > > > > > > public class ResourceItemModel implements ModelLocator > > > > > > > { > > > > > > > public var username:String; > > > > > > > public var firstName:String; > > > > > > > public var lastName:String; > > > > > > > // These are used by an itemRenderer > > > > > > > public var label:String; > > > > > > > public var selected:Boolean; > > > > > > > .... > > > > > > > } > > > > > > > > > > > > > > > > > > > > > The List is a list of CheckBoxes with the username as the > label. > > > > When > > > > > > > someone selects one of the CheckBoxes, it go off and sets > the > > > > > > > 'selected' property of the specific ResourceItemModel to > true. > > > > This > > > > > > > part works just fine. > > > > > > > > > > > > > > After a certain user gesture, I want to set all selections > back > > > to > > > > > > > false, then reselect any CheckBox selections that may have > > > > existed. > > > > > > > This information comes from another model. The resetting > of the > > > > > > > CheckBoxes is in a loop that does: > > > > > > > ResourceItemModel(userSummaries[i]).selected = false; > > > > > > > > > > > > > > This properly sets the models selected property to false, > but > > > > the view > > > > > > > does not update (ie. the CheckBox is still selected). > > > > > > > > > > > > > > > > > > > > > How do I update the itemRender after I programmaticly > update the > > > > > > > dataProvider? > > > > > > > > > > > > > > Thanks, > > > > > > > Geoff > > > > > > > > > > > > > > > > > > > > > > > > > > > >