If your checkBox selected states are in a comma separated string, you
can use split to put that into an array, the loop over the array and set
the individual check box states.  Note the selected requires a Boolean,
but you will have a string, so you will probably use a ternary
expression:

Cbx0.selected = (aSelections[0] == "true")? true:false;

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of sbnkn
Sent: Wednesday, November 26, 2008 9:44 AM
To: [email protected]
Subject: [flexcoders] Re: Checkbox in datagrid

 

Are the CheckBoxes in the Form or in the DataGrid, or both? -- Only 
in the form

What is the dataProvider for the DataGrid? -- xml value from DB thru 
Httpservice

How are you linking the Form to the DataGrid? 
<mx:Button label="Edit Announcement" click="showEdit
(dgAnnouncements.selectedItem)" />

dgAnnouncements is the id name for Datagrid.

the function:showEdit
private function showEdit(item:Object):void
{
strTitle.text = item.strTitle;
strContent.text = item.strContent;
cntAnnouncement.text = item.cntAnnouncement;
dtmOpenDate.text = item.dtmOpenDate;
dtmCloseDate.text = item.dtmCloseDate;
dtmAssignmentDueDate.text = item.dtmAssignmentDueDate;
strPartners.text = item.strPartners;}

strPartners holds the checkbox values now. 

How are the CheckBox states being stored in your dataProvider item?
-- In the datagrid, I have it as comma seperated values.

Hope these give a more detailed explanation to help.

Thanks,
-NB

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> Are the CheckBoxes in the Form or in the DataGrid, or both?
> 
> 
> 
> What is the dataProvider for the DataGrid?
> 
> 
> 
> How are you linking the Form to the DataGrid?
> 
> 
> 
> How are the CheckBox states being stored in your dataProvider item?
> 
> 
> 
> Tracy
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of sbnkn
> Sent: Tuesday, November 25, 2008 3:30 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Checkbox in datagrid
> 
> 
> 
> Hi ALL,
> 
> This group is being really helpful.
> 
> I have asked a question earlier and people responded with answers 
on 
> the same day. I appreciate and thank you all.
> 
> Now back to the another question.
> 
> I have a form to enter and a datagrid to display the records. 
> Form has: text, textarea and multiple check box. once I add text 
and 
> select multiple values in the checkbox and submit. This gets into 
the 
> DB. This works fine.
> 
> Example to explain the scenario: checkbox has 1, 2, 3, 4 as options 
> to select. When the user selected 3,4. The DB gets inserted with 3,4
> 
> Now, when I select any record from the datagrid, the form gets 
> populated with the selected datagrid value and this works fine too
> except for the checkbox values.
> 
> Example to explain the scenario: DB has 3,4 the form needs to have 
> 3,4 checked.
> 
> Question: How do i enable checkbox (having checkbox selected=true) 
> for only the values in the DB.
> Any example direction would be great.
> 
> -NB
>

 

Reply via email to