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?   

                         

Reply via email to