Notes for flex repeater controls
Repeater, as its name implies, means repeat, and repeater is a control used for repetition.
The repeater generates the number of child items based on the number of objects in the data source. All the child items generated are in the form of arrays.
<Mx: repeater id = "myrepeater" dataprovider = "{myarray}">
<Mx: hbox>
<Mx: linkbutton id = "mylabel" label = "{myrepeater. currentitem. name}" Click = "show (event. currenttarget. getrepeateritem ()"/>
<Mx: textinput text = "{myrepeater. currentitem. Age}"/>
</MX: hbox>
</MX: repeater>
There is a common problem:
No. When we call a function and pass the field in repeater as a parameter, the error "Repeater is not executing" cannot be passed.
However, getrepeateritem () is the best solution to this problem.
We don't even need to pass getrepeateritem ()
Pass an event in the past. Use event. currenttarget. getrepeateritem (),
You can also obtain the currentitem of the current object.
We also recommend that you do not use repeater for processing if you can use the DataGrid at ordinary times. Repeater will greatly compromise the efficiency.
We recommend that you go to http://livedocs.adobe.com/flex/3/html/index.html flexflex文 to learn more.
Although the English language is not good, we can understand the code, which is of great benefit to those who learn flex.
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute"> <br/> <mx: SCRIPT> <br/> <! -- [CDATA [<br/> Import MX. messaging. abstractconsumer; <br/> Import MX. collections. arraycollection; <br/> private var my: array = [{name: "A", age: 1 },{ name: "B", age: 2 },{ Name: "C", age: 3}]; <br/> [Bindable] <br/> private var DP: arraycollection = new arraycollection (my ); <br/>] --> <br/> </MX: SCRIPT> <br/> <mx: vbox x = "144" Y = "118" width = "319" Height = "224"> <br/> <mx: repeater id = "RP" dataprovider = "{DP}"> </P> <p> <mx: radiobutton label = "{Rp. currentitem. name} "Click =" aa.text=event.tar get. getrepeateritem (). age "/> </P> <p> </MX: repeater> <br/> <mx: textinput id =" AA "/> <br/> </MX: vbox> <br/> </MX: Application> <br/>