Set some selected props to true before assigning the dp to see if it is
picking it up.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Geoffrey
Sent: Wednesday, November 14, 2007 9:27 AM
To: flexcoders@yahoogroups.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> " 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>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Oh, maybe you need to set selectedField="selected"
> 
> 
> 
> ________________________________
> 
> 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 8:37 AM
> To: flexcoders@yahoogroups.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> , "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@yahoogroups.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>
> 
> > > 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>
> > > , "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
> > > >
> > >
> >
>

 

Reply via email to