I am probably a complete dumb. But dataModel does not have dataProvider property. How do I pull data into model then?
Tracy Spratt <[EMAIL PROTECTED]> wrote: Or the short answer, the same way you got the data into the dataProvider for the DataGrid. Tracy --------------------------------- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Knudsen Sent: Monday, December 31, 2007 10:22 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Two way binding That's a wholly different thread. You would use WebService, HTTPservice, or RemoteObject to perform some sort of server call. Take a look at the docs on these tags and also at the examples on Adobe.com. For a ColdFusion based example, you can check this out http://www.acfug.org/index.cfm?fa=meetings.meetingdetail&EventID=177 DK On Dec 31, 2007 10:14 AM, mark goldin <[EMAIL PROTECTED]> wrote: And how data from server gets into the Model? Douglas Knudsen <[EMAIL PROTECTED] > wrote: What's wrong with this? <mx:TextInput text="{ someReferenceToAModel.property }" /> Now, you can use the Binding tag to bind the value in the above back to the source, your datagrid in this case, but its not really a good idea, though YMMV. DK On Dec 31, 2007 9:33 AM, markgoldin_2000 <[EMAIL PROTECTED]> wrote: I am trying to figure out what both ways of data binding are. Basically we have two subjects for data binding: DataGrid and a Form. With DataGrid it is pretty clear: dataProvider. But with form? It does not have such a dataProvider property (Which is in my opinion it should have). So, what's a solution for that? DataModel? Which it turn does not have dataProvider either. But it does have a source. Source of what? Data? Ok, let's stick to dataModel. But then I am reading that it's better to use class-based models. Here is an example of class-based model form Help: package { [Bindable] public class ShoppingCart { public var items:Array = []; public var total:Number = 0; public var shippingCost:Number = 0; public function ShoppingCart() { } public function addItem(item:Object, qty:int = 1, index:int = 0):void { items.splice(index, 0, { id: item.id, name: item.name, description: item.description, image: item.image, price: item.price, qty: qty }); total += parseFloat(item.price) * qty; } public function removeItemAt(index:Number):void { total -= parseFloat(items[index].price) * items[index].qty; items.splice(index, 1); if (getItemCount() == 0) shippingCost = 0; } public function getItemCount():int { return items.length; } public function getTotal():Number { return total; } } } Two questions: 1. How the data is getting into a picture here? 2. How am I using this model in my mxml file? Sorry if I am asking something obvious, but I am just having problem understanding why data-centric environment does not have a straight way of binding data both ways. All I would want is to assign a data source to my form and then specify data fields for each control in the form. Simple as this. Is this possible in Flex? Thanks -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it?