Sure thing...
// the array
arrData = [
{sName: 'web 1',
sURL:'http://192.168.0.1',sUsername:'admin',sPassword:'[EMAIL PROTECTED]'},
{sName: 'web 2',
sURL:'http://192.168.0.2',sUsername:'admin',sPassword:'[EMAIL PROTECTED]'},
{sName: 'web 3',
sURL:'http://192.168.0.3',sUsername:'admin',sPassword:'[EMAIL PROTECTED]'}
];
// and the repeater code
<mx:Repeater id="serverList" dataProvider="{arrData}">
<mx:HBox width="100%" textAlign="left">
<mx:TextInput width="98" x="0" id="sName"
text="{serverList.currentItem.sName}" />
<mx:TextInput width="225" x="106" id="sURL"
text="{serverList.currentItem.sURL}" />
<mx:TextInput width="95" x="334" id="sUsername"
text="{serverList.currentItem.sUsername}" />
<mx:TextInput width="95" x="437" id="sPassword"
text="{serverList.currentItem.sPassword}" displayAsPassword="true" />
<mx:Button width="22" height="22" click="clearData(event)"
styleName="btnDeleteServer" id="dServer" />
</mx:HBox>
</mx:Repeater>
-----Original Message-----
From: Stefan Richter [mailto:[EMAIL PROTECTED]
Sent: Monday, June 16, 2008 3:17 PM
To: Flex
Subject: Re: Referencing textInput fields from within a TileList
Are you using a Repeater now? Can you post the whole code snippet?
Regards,
Stefan
On 16 Jun 2008, at 21:07, Andy Matthews wrote:
> Okay...
>
> I see how you did it. You gave the repeater an ID, then used that to
> get at the data. However, when I try to do this:
>
> <mx:TextInput width="98" x="0" id="sName{serverList.currentItem}" />
>
> I get the following error:
> 'sName{serverList.currentItem}' is not a valid identifier
>
> When I try to output that variable into a text area, I simply get
> [object Object].
>
> What am I doing wrong?
>
>
> -----Original Message-----
> From: Andy Matthews [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 16, 2008 2:58 PM
> To: '[email protected]'
> Subject: RE: Referencing textInput fields from within a TileList
>
> Stefan...
>
> I'm going to give that a try as that might get me where I want to go.
> But I guess my primary question is "is that the best way"? Given my
> explanation of what I'm trying to, is there a better/easier way to get
> at the data?
>
>
> andy
>
> -----Original Message-----
> From: Stefan Richter [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 16, 2008 2:40 AM
> To: Flex
> Subject: Re: Referencing textInput fields from within a TileList
>
> Hi Andy,
> you can use the currentItem property to set dymanic values within the
> repeater:
>
>
> <mx:Script>
> <![CDATA[
> [Bindable]
> public var myArray:Array=[1,2,3,4];
> ]]>
> </mx:Script>
>
> <mx:ArrayCollection id="myAC" source="{myArray}"/>
> <mx:Repeater id="myrep" dataProvider="{myAC}">
> <mx:Label id="Label1" text="This is loop #{myrep.currentItem}"/>
> </mx:Repeater>
>
>
> Like this you could also assign values out of your array to the
> component that's being repeated.
>
>
> HTH
>
> Stefan
>
>
>
>
> On 16 Jun 2008, at 02:35, Andy Matthews wrote:
>
>> I thought about using a repeater but I'm stuck on this idea of
>> "naming" each of the textinput fields like I would in ColdFusion:
>>
>> loop
>> <textinput name="sName+i">
>> /loop
>>
>> But I'm guessing that Repeater doesn't work quite like that. The
>> hardest part is knowing how to get at the values from the input
>> fields, regardless of how I'm creating them.
>>
>>> Its kind of odd to use a Tile List for this honestly. For one,
>>> doesn't appear TileLists support the idea of itemrenderer as editor.
>>> Not saying it can't be used, but IMHO, I'd probably just use a
>>> Repeater over a custom window shade type of component. See Flex lib
>>> for what I'm speaking of. Each of these could have a instance of
>>> your data objetc, you are using a typed object, right? Then it
>>> would be cake to gatehr the data and send it away. You could use
>>> the datagrid for this too, but I'm not a huge fan of editable
>>> datagrids, rarely touch them over the past year, for one thing they
>>> do not support the UI validation paradigm other input controls do.
>>> Read up on the datagrid, once you understand how item editors work
>>> you will realize the easy in gathering your edited data and sending
>>> on the way.
>>>
>>> DK
>>>
>>>
>>>>
>>
>>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5340
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37