This doesn’t work in the alpha but it will at some point.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*">

 

    <mx:Script>

        <![CDATA[

        [Bindable]

        public var sourceData:XML = <items>

          <item><name>One</name><price>100</price></item>

              <item><name>Two</name><price>200</price></item>

              <item><name>Three</name><price>300</price></item>

        </items>;

       

        ]]>

    </mx:Script>

          

   <mx:XMLListCollection id="data" source="{sourceData.item}" />

 

    <mx:Form>

          <mx:Repeater id="r" dataProvider="{data}">

             <mx:FormItem label="{String(r.currentItem.name)}">

             <mx:TextInput text="{String(r.currentItem.price)}" valueCommitted="TextInput(event.target).getRepeaterItem().price = TextInput(event.target).text" />

             </mx:FormItem>

          </mx:Repeater>

    </mx:Form>

   

    <mx:Button label="dump" click="debug.text = data.toXMLString()" />

 

    <mx:TextArea id="debug" width="100%" height="100%" />

   

</mx:Application>

 

 


From: [email protected] [mailto:[email protected]] On Behalf Of Don Dwoske
Sent: Thursday, October 27, 2005 8:11 AM
To: [email protected]
Subject: Re: [flexcoders] Re: Two way data binding?

 

Thanks Matt...  could you provide an example of how to specify the update of the data?

I assume that there would be a bit of code inside the mouseOut handler (or wherever I want) to push the data back into the XML model.

Figure I have this TextInput bound to the xml (e4x) ...

<mx:TextInput id="price" text="[EMAIL PROTECTED]" mouseOut=" what goes here? " >

This is a simple case, but the solution should also elegantly apply to automatically generated / replicated list items... and also executable by any arbitrary code easily....

so some distant script could say  price.model.update()  or something to push the current price.text back into the xml where it came from...



-Don

On 10/26/05, Matt Chotin <[EMAIL PROTECTED]> wrote:

The automatic update of the data itself will be available in the Framework, the data services is what allows for automatic transfer back to the server.

 

The cell renderer APIs may help show you what can be done in Flex 2 as well.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Dave Wolf
Sent: Wednesday, October 26, 2005 7:34 AM
To: [email protected]
Subject: [flexcoders] Re: Two way data binding?

 

This will be handled in the Flex2 data services.  More importantly is
that the changes (inserted, added and deleted buffers) will be
marshalled to the server as needed and can be bound to a persistence
adapter (say Hibernate) to even manage updating the data store with
the changes.

That's where the real power comes in.

--
Dave Wolf
Cynergy Systems, Inc.
Macromedia Flex Alliance Partner
http://www.cynergysystems.com

Email:  [EMAIL PROTECTED]
Office: 866-CYNERGY x85

--- In [email protected], "ddwoske" <[EMAIL PROTECTED]> wrote:
>
> I have big problems understanding something.
>
> I basically want to build UI components which modify underlying XML so
> that I can send the modified XML back to the server.  I want to bind
> some TextInput components to portions of the XML and when I change the
> text then I want the XML to be automatically updated.  This doesn't
> seem possible, and if it is, it doesn't seem very easy.
>
>
> Using OpenLaszlo here is a simple, but complete program for modifying
> the price of a list of items:
>
> <canvas height="400" debug="true" >
> <debug y="200" />
> <dataset name="inventory" >
>   <items>
>   <item><name>One</name><price>100</price></item>
>   <item><name>Two</name><price>200</price></item>
>   <item><name>Three</name><price>300</price></item>
>   </items>
> </dataset>
>
> <view>
>   <simplelayout axis="y" />
>   <!-- Laszlo creates a replicated view for each
>        of my item -->
>   <view datapath="inventory:/items/item" >
>     <text datapath="name/text()" />
>     <edittext x="100" datapath="price/text()">
>        <method event="onblur">
>            this.datapath.updateData();
>        </method>
>     </edittext>
>   </view>
>
>   <button >
canvas.datasets.inventory.serialize() )">
>    Dump XML</button>
>
> </view>
> </canvas>
>
> You can try running it here:
>
http://www.laszlosystems.com/lps-3.0/laszlo-explorer/editor.jsp?src=""
>
> I can change the prices on the screen, and the underlying XML is
> automatically updated through the use of the updateData() method.
>
> Does this two-way binding exist in Flex 2.0 ?
>
> I see how you can add a mouseOut handler, but I don't see how to push
> the data back into the XML model from where it came from without some
> fancy code in the handler.. can someone tell me how to do this?
>
>
> Cheers,
>   Don
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com



SPONSORED LINKS

Web site design development

Computer software development

Software design and development

Macromedia flex

Software development best practice

 

 


YAHOO! GROUPS LINKS

 

 





--

---------------------------------------
Donald Dwoske
Software Journeyman
http://www.loraxis.com/ddwoske



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to