Re: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-08 Thread Richard Rodseth



Isn't there some way to trigger valueCommitted at *submit* time?
I don't think the model should be updated when each checkbox is
clicked, but I like the idea of connecting the control to the data
source declaratively.

- RichardOn 11/7/05, m_chotin [EMAIL PROTECTED] wrote:




clicking on the checkbox should cause the valuecommitted event to fire
i think. otherwise the click event should be OK too unless you expect
to change it programmatically.








--
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
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









RE: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-08 Thread Alon J Salant










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
flexcodershttp://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 






SPONSORED
LINKS 




 
  
  Web site design development 
  
  
  Computer software development 
  
  
  Software design and development 
  
 
 
  
  Macromedia flex 
  
  
  
  
  
  
  
 












YAHOO!
GROUPS LINKS





 Visit your group
 flexcoders
 on the web

RE: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-08 Thread Matt Chotin










No, if you want to defer the read to
submit youll need to take a manual approach











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Richard Rodseth
Sent: Tuesday, November 08, 2005
9:16 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: Flex
1.5 - n checkboxes





Isn't there some way to
trigger valueCommitted at *submit* time? I don't think the model should
be updated when each checkbox is clicked, but I like the idea of connecting the
control to the data source declaratively.

- Richard



On 11/7/05, m_chotin
[EMAIL PROTECTED]
wrote:

clicking on the checkbox
should cause the valuecommitted event to fire
i think. otherwise the click event should be
OK too unless you expect
to change it programmatically.














--
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" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











Re: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-08 Thread JesterXL





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 - 
From: Alon J Salant 

To: flexcoders@yahoogroups.com 
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 
RodsethSent: Wednesday, 
November 02, 2005 4:40 PMTo: 
flexcoders@yahoogroups.comSubject: 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:RepeaterNow, 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 
buildform selection elements based 
on different control types (eg.checkboxes, radio buttons, etc...). The data model we 
worked withprovided us with the 
string name of the control type to use, and theappropriate data structure to populate the control 
type(s). SolutionI came up 
with was to (as you mention you might have to do) create 
theform elements using 
actionscript, more specifically the createChildmethod. I created a custom instance of each control 
type, and addedsome additional 
properties to it, the most important being the dataproperty it needed to affect. Inside the custom 
control, I had mychange event 
directly modify the data property that was passed in. Because the reference was passed in, this essentially "bound" 
thatchange to the data model it 
came from. Problem solved.Your requirements may be slightly different as it sounds like 
youalready know what type of 
control you need to render. In this case, Iwould imagine you could use a repeater tag and have it's 
children bethe custom "check box" 
you're creating, and pass in the objectproperty 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 
dataprovider 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 
valueobjects). I'm 
guessing there's no way around using Actionscipt to populate theform 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 toan 
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'munclear 
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"flexcodershttp://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/.  
  
-- 
--Flexcode

Re: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-07 Thread Richard Rodseth



Thanks, Matt. I was working on such a loop, but I like that
valueCommitted idea better. But I haven't been able to figure out how
to trigger valueCommitted for the checkboxes, since there is no focus
to be lost. 

- RichardOn 11/3/05, Matt Chotin [EMAIL PROTECTED] wrote:

















So there will be an array on your document
called role and you could loop through it and grab the name and selected state.



Var selectedRoles:Array = [];

For (var i:Number=0; I  role.length;
i++)

{

 If (role[i].selected)

 {

 selectedRoles.push([role[i].label);

 }

}



But yes, it's better to store these
things in a Model or just update the user directly:



mx:CheckBox id="role"
label="{rolesList.currentItem}" selected="{user.hasRole(rolesList.currentItem)}"
valueCommitted="user.setRole(event.target.getRepeaterItem(),
event.target.selected)" /



Matt











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
flexcodershttp://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/flexcodersF

[flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-07 Thread m_chotin
clicking on the checkbox should cause the valuecommitted event to fire
i think.  otherwise the click event should be OK too unless you expect
to change it programmatically.

--- In flexcoders@yahoogroups.com, Richard Rodseth [EMAIL PROTECTED] wrote:

 Thanks, Matt. I was working on such a loop, but I like that
valueCommitted
 idea better. But I haven't been able to figure out how to trigger
 valueCommitted for the checkboxes, since there is no focus to be lost.
 
 - Richard
 
 On 11/3/05, Matt Chotin [EMAIL PROTECTED] wrote:
 
   So there will be an array on your document called role and you
could loop
  through it and grab the name and selected state.
 
   Var selectedRoles:Array = [];
 
  For (var i:Number=0; I  role.length; i++)
 
  {
 
  If (role[i].selected)
 
  {
 
  selectedRoles.push([role[i].label);
 
  }
 
  }
 
   But yes, it's better to store these things in a Model or just
update the
  user directly:
 
   mx:CheckBox id=role label={rolesList.currentItem} selected={
  user.hasRole(rolesList.currentItem)} valueCommitted=user.setRole(
  event.target.getRepeaterItem(), event.target.selected) /
 
   Matt
 
--
 
  *From:* flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] *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:[EMAIL PROTECTED] *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

Re: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-03 Thread Richard Rodseth



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,
RichardOn 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
flexcodershttp://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









  
  
SPONSORED LINKS
  
  
  


Web site design development
  
  

Computer software development
  
  

Software design and development
  
  



Macromedia flex
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group flexcoders on the web.
  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




  
















--
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" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









RE: [flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-03 Thread Matt Chotin










So there will be an array on your document
called role and you could loop through it and grab the name and selected state.



Var selectedRoles:Array = [];

For (var i:Number=0; I  role.length;
i++)

{

 If (role[i].selected)

 {

 selectedRoles.push([role[i].label);

 }

}



But yes, its better to store these
things in a Model or just update the user directly:



mx:CheckBox id=role
label={rolesList.currentItem} selected={user.hasRole(rolesList.currentItem)}
valueCommitted=user.setRole(event.target.getRepeaterItem(),
event.target.selected) /



Matt











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
flexcodershttp://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 






SPONSORED
LINKS 




 
  
  Web site design development 
  
  
  Computer software development 
  
  
  Software design and development 
  
 
 
  
  Macromedia flex 
  
  
  
  
  
  
  
 












YAHOO!
GROUPS LINKS





 Visit your group

[flexcoders] Re: Flex 1.5 - n checkboxes

2005-11-02 Thread Brendan Meutzner
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:[EMAIL PROTECTED] *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
flexcodershttp://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/.
 
 
   --
 








 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
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

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/