0
votes

I am new to flex, and I need a datagrid, which contains checkbox (4 no's) without multiple selection. And I also need a text area which should contain the selected checkbox's label/data. I tried using arraycollection but I am not getting.

2
This is a very ambiguous question. Can you give us an example showing how you want the rows of data in the grid to look? e.g., Do you want 4 checkboxes in a single cell, or in 4 columns, or in 4 rows? - Glenn
i need 4 checkboxes in a single column and without multiple selection.. - Kishor
I need 4 checkboxes in a single column and without multiple selection, also a text area to display selected checkbox's label/data. - Kishor

2 Answers

1
votes

You probably want 4 radioButtons (and a radioGroup ). But you can do it with checkboxes.

This will get you started:

            <mx:itemRenderer>
                <mx:Component>
                    <mx:VBox>
                      <mx:CheckBox change="onChange(event);"/>
                      <mx:CheckBox change="onChange(event);"/>
                      <mx:CheckBox  change="onChange(event);/">
                      <mx:CheckBox  change="onChange(event);"/>

                        <mx:Script>
                            <![CDATA[
                                private function onChange(evt:Event):void {
                                    //change the data to reflect the selected item.
                                    //update the datagrid's dataProvider 
                                }
                            ]]>
                        </mx:Script>
                    </mx:VBox>
                </mx:Component>
            </mx:itemRenderer>

You will then need to issue an update event to the datagrid's dataProvider so that the textArea can be updated as well.

You will also need to have the renderer initially select the correct checkbox as well, when the data is set/updated.

0
votes

What you need is an itemrenderer which has a checkbox and textarea associated to it. See this to get an idea on how to use item renderer. Also to handle multiple selections it is possible using a radio group but in this case you have to write a handler function for the checkbox to tick off other checks if there are any.