I agree; wrapping my head around Repeater has been
very tough; it's so much easier to create either a cellRenderer that does what
you want in a List, or just use createChild/destroyChild with a
VBox.
----- Original Message -----
Sent: Tuesday, November 08, 2005 2:14 PM
Subject: RE: [flexcoders] Re: Flex 1.5 - n checkboxes
A high level comment
that may help you to put your problem and solution in a different
light
In our work with Flex I
have found using a repeater to be a bad smell worth looking in to. Usually,
replacing a repeater with a List and CellRenderer cleans things up immensely and
enables componentization of your solution including easier event handling and
data binding. Remember that a List is not necessarily a ComboBox or a DataGrid.
We have found that many UI programming tasks decompose well into a List and
CellRenderer.
Alon
From:
flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com]
On Behalf Of Richard
Rodseth Sent: Wednesday,
November 02, 2005 4:40 PM To:
flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Flex 1.5 - n
checkboxes
No, my requirements are simple. An "Edit
User" panel with checkboxes for all the roles the user has.
I have the
check boxes rendering as follows
<mx:Repeater id="rolesList"
dataProvider="{allroles}">
<mx:CheckBox id="role" label="{rolesList.currentItem}"
selected="{user.hasRole(rolesList.currentItem)}" />
</mx:Repeater>
Now, I need to submit the form,
and call user.setRoles() with an array of the the checked roles. Right now there
roles are just strings, but they should probably be Role objects. Presumably
I will need a submit handler that iterates over the checkboxes looking at their
selected state and building the array of checked ones. I don't know how to do
that yet, but I'm sure I can figure it out. It would be nifty if there was a
more automatic way to do this.
Thanks, Richard
On 11/2/05, Brendan Meutzner <[EMAIL PROTECTED]>
wrote:
Hi Richard,
I recently completed a project in which we had to dynamically
build form selection elements based
on different control types (eg. checkboxes, radio buttons, etc...). The data model we
worked with provided us with the
string name of the control type to use, and the appropriate data structure to populate the control
type(s). Solution I came up
with was to (as you mention you might have to do) create
the form elements using
actionscript, more specifically the createChild method. I created a custom instance of each control
type, and added some additional
properties to it, the most important being the data property it needed to affect. Inside the custom
control, I had my change event
directly modify the data property that was passed in. Because the reference was passed in, this essentially "bound"
that change to the data model it
came from. Problem solved.
Your requirements may be slightly different as it sounds like
you already know what type of
control you need to render. In this case, I would imagine you could use a repeater tag and have it's
children be the custom "check box"
you're creating, and pass in the object property reference that needs to be
changed.
Hope this helps
you...
Brendan
--- In flexcoders@yahoogroups.com, Richard Rodseth
<[EMAIL PROTECTED]> wrote: > > Yes, as I mentioned, I am using the repeater tag. But the
data provider for > it is the
list of all possible roles. I'm interested in the process of > mapping the checked items to an array of objects (strings or
value objects). > I'm
guessing there's no way around using Actionscipt to populate the form > from the model and vice
versa. > > -
Richard > > On 11/2/05,
Matt Chotin <[EMAIL PROTECTED]> wrote: >
> > > Check out the Repeater
tag. > > >
> ------------------------------ >
> > > *From:* flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] *On >
> Behalf Of *Richard Rodseth > > *Sent:*
Wednesday, November 02, 2005 9:07 AM > > *To:* flexcoders@yahoogroups.com > >
*Subject:* [flexcoders] Flex 1.5 - n checkboxes >
> > > Is there a slick way to bind a
variable number of checkboxes to an
array > > of value objects in a data
model? > > > >
Example: user has an array of roles. Display a list of
checkboxes > > I see how to use repeaters to
render the checkboxes, but I'm unclear
on > > the best way to capture the user
selections. > > > >
Thanks > > >
> > > > >
-- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > > > >
> ------------------------------ > >
YAHOO! GROUPS LINKS > > > > > > - Visit
your group "flexcoders<http://groups.yahoo.com/group/flexcoders>" > > on the web. >
> - To unsubscribe from this group, send an email
to: > > [EMAIL PROTECTED]<
[EMAIL PROTECTED]> > > - Your use of Yahoo! Groups
is subject to the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/>. > > >
> > >
------------------------------ >
> >
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
--
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
|