Pergunta

The dataProvider of my datagrid is an arrayCollection with 2 columns. The first column of the arrayCollection contains true or false (so that the checkbox is selected) and the other column contains the tags, this means that the arraycollection does not contain the actual string to be displayed on each checkbox. The tags that need to be used will fetch the label from an XML file. So the labels will come from an XML file.

The XML file is as such :

<tags>
 <tags1>CheckBox Label 1</tags1>
 <tags2>CheckBox Label 2</tags2>
 <tags3>CheckBox Label 3</tags3>
</tags>

Hence believe I will need to use 'labelFunction" attribute on the DatagridColumn. Is this the way to be used so that I can show the label on each checkBox in the datagrid?

The code for my datagrid is as such:

<mx:DataGrid id="myGrid" dataProvider ="myDP" showHeaders="false" headerHeight="0">
                    <mx:columns>

                        <mx:DataGridColumn headerText="" dataField="IS_ACCESSIBLE">
                            <mx:itemRenderer>
                                <fx:Component>
                                    <mx:HBox horizontalAlign="left">
                                        <s:CheckBox id="mycheckBox"/>
                                    </mx:HBox>
                                </fx:Component>
                            </mx:itemRenderer>
                        </mx:DataGridColumn>

                    </mx:columns>
                </mx:DataGrid>

Can anyone help me with this issue?

Thanks

Foi útil?

Solução

I have been able to set the label attribute of the checkbox as such :

label= "{outerDocument.myXML.tags[data.tags]}"

Using the [] and the "data.tags", which actually come from the dataProvider of the datagrid solves this problem. This make the last part of the variable dynamic.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top