Hmm, 100 properties and you want economy
of code. What if you created an array of the property names:
var propNames:Array = new Array();
for (var propName:String in inputVo)
{
propNames.push(propName);
}
OK, now take that array and populate a
repeater:
<mx:Repeater id=”r”
dataProvider=”{propNames}”>
</mx:Repeater>
Now the body of that repeater can be a
textInput:
<mx:TextInput text=”{inputVo[r.currentItem]}”
change=”inputVo[event.target.getRepeaterItem()] = event.target.text”
/>
It would be a lot of TextInputs being
drawn at once. You could potentially do something a little more efficient by
writing a cell renderer that could be used in a DataGrid if you didn’t
want all 100 TextInputs rendering at once.
HTH,
Matt
Hi all,
In my case, I have two kinds of value object, an
input value object
and a submit form.
<mx:Script>
Import
my.vo.InputVO;
function init(){
inputVo:InputVO = new InputVO();
inputVo.name = ¡¥test¡¦;
}
function submit(){
inputVo.name = name.text;
¡K..
}
</mx:Script>
<mx:Form id="inputForm">
<mx:FormItem label="FirstName"
required="true">
<mx:TextInput
id="name" value="{inputVo.name}" />
</mx:FormItem>
</mx:Form>
If there were only a few input fields, the
question is very simple.
I could use data binding to show the properties in
inputVo and write
<mx:Model> or hardcode to set up data from
input field to Value
Object. But today I have 100 input fields in one
Form and 100
properties in one Value Object. I can show Value
Object by
{inputVo.*}, but how can I write an efficient code
for another
direction binding transformation?
I searched flex coder and haven¡¦t found any
solution; please give
me a hint to complete it.
Alex Yang
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
---- LSpots keywords ?>
---- HM ADS ?>
YAHOO! GROUPS LINKS