I think you're right that binding may not be the best solution here.
What if your TextInput looked like this:
<mx:TextInput id="cdc" width="35" text="{
CTabellaSviluppoVO(vosviluppo[key]).tga1sv==undefined ?
'':CTabellaSviluppoVO(vosviluppo[key])['tga'+r.currentIndex+'sv']}" />
That would get the proper text from your array based on the key into the
TextInput I think.
Now you want to copy it back, you can either use a for loop for all fields
that would be triggered by a button:
function updateVO()
{
for (var i=0; i<cdc.length; ++i)
{
vosviluppo[key]['tga'+i+'sv'] = cdc[i].text;
}
}
Or if you didn't want the button you could maybe use the change event on the
text input (or valueCommitted) to do the copy:
<mx:TextInput ... valueCommitted="
vosviluppo[key]['tga'+event.target.getRepeaterIndex()+'sv'] =
event.target.text" />
Does that make sense? Hopefully we're talking about an independent array
here. Remember, if your VO is also being shown in a DataGrid or List you
may want to use the editField method on the dataProvider as opposed to
changing vosviluppo[key] directly.
Matt
________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 24, 2005 5:54 AM
To: [email protected]
Subject: [flexcoders] Binding we are confused
sorry Matt, but i haven't understand you can explain me please? :-(
I have also post this question in Macromedia Italia tech (Enrique)
but without success because if you look our binding , it's ok work, but
i think that there are a better solution than ours.
I make you an example that yesterday it has aroused a some of problems.
I have an array :
<mx:HBox>
<mx:Repeater id="r" dataProvider="{taglie}" recycleChildren="true">
<mx:FormItem label="{r.currentItem}" required="{r.currentItem!=tg_base}" >
<mx:TextInput id="cdc" width="35" text="0" />
</mx:FormItem>
</mx:Repeater>
</mx:HBox>
These TextInput they would owe to be to bind with our vo object (see
attachment). but in progressive mode, for example
cdc[0].text=vo.tga1sv
cdc[1].text=vo.tga2sv
......
cdc[10].text=vo.tga10sv
....
and when user chage some TextInput and click theUpdate button
we have to hold the object VO syncronized .
Now we are using a circular binding , but ok work, but throws warnings
in the second line, and and honestly i'm worried, in what I think there
will be a valid alternative,
<!--Taglie -->
<mx:Binding
source="{CTabellaSviluppoVO(vosviluppo[key]).tga1sv==undefined ?
'':CTabellaSviluppoVO(vosviluppo[key]).tga1sv}"
destination="cdc[0].text" />
<mx:Binding source="cdc[0]"
destination="CTabellaSviluppoVO(vosviluppo[key]).tga1sv" />
yesterday in Macromedia Tech Italy have recommended us to use a circular
binding unfortunately, but in my case it doesn't seem you an ugly
solution, and besides I receive some warnings therefore
I think about having adopted a wrong solution for my case.
Any suggestion it's MUCH MUCH appreciate.
Devis
Matt Chotin ha scritto:
> Hi Devis,
>
> I think you're asking how to use binding to do an "insert" as opposed
> to an "edit" operation? This is probably hard to do with binding.
> Instead what I'd do is simply have a button or some other mechanism
> that will do the addition for you and only use binding to copy out for
> the VO.
>
> Matt
>
> ------------------------------------------------------------------------
>
> *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, March 22, 2005 11:32 AM
> *To:* [email protected]
> *Subject:* [flexcoders] Binding with amf
>
> Hi,
>
> it's correct, or there is a best way, this binding about you?
>
> <mx:Binding source="t_rig.text"
> destination="CTabellaSviluppoVO(vosviluppo[key]).pk.rifesv" />
> <mx:Binding
> source="{CTabellaSviluppoVO(vosviluppo[key]).pk.rifesv==undefined ? '':
> CTabellaSviluppoVO(vosviluppo[key]).pk.rifesv}" destination="t_rig.text"
> />
>
> In my project, when "scroll" the VO object bind the t_rig.text, but if i
> wish to insert a new VO the value of t_rig.text will into into
> vosviluppo[key]).pk.rifesv.
>
> Please can you give me more ligth about this concept.
> Devis
>
>
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> click here
>
<http://us.ard.yahoo.com/SIG=1294bon7h/M=298184.6191685.7192823.3001176/D=gr
oups/S=1705007207:HM/EXP=1111645956/A=2593423/R=0/SIG=11el9gslf/*http://www.
netflix.com/Default?mqso=60190075>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
>���� * To visit your group on the web, go to:
>������ http://groups.yahoo.com/group/flexcoders/
>���� * To unsubscribe from this group, send an email to:
>������ [EMAIL PROTECTED]
>������ <mailto:[EMAIL PROTECTED]>
>���� * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>������ Service <http://docs.yahoo.com/info/terms/>.
>
>
Yahoo! Groups Sponsor
ADVERTISEMENT
________________________________________
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
�
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
�
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/