Ok, I've
got a form that requires me to be able to have multiple subtransactions that
can be submitted with one click.
The way I have it set up is when you've completed the form you click a button
and it adds the values of the form fields to an object within an
ArrayCollection. That ArrayCollection is bindable and is set as the dataprovider
for a datagrid that lists these sub-transactions. I can add as many items to
this "queue" as I like, and that part works just fine.
The part I'm having trouble with is when I want to post those records to the
database.
I have a model set up for the remoting. It worked fine when I was passing the
values from the form to the model then to the DB, but I'm not sure how to pass
the data from the ArrayCollection into the model to be submitted.
In the save function I have the following code
for each (var item:Object in transactionArray)
{
saveItem(this.detailObject);
}
where transactionArray is the ArrayCollection and detailObject is the model.
Now, it does run the remoting call for each of the line items, it's just not
putting the data into the model, so I'm getting empty records.
My ArrayCollection looks like this:
private var transactionArray:ArrayCollection = new ArrayCollection(
[{
EnvNum:
'',
DateTrans: '',
Currency: '',
CheckNum: '',
Fund: '',
Amount: '',
Comment: '',
TransID: '',
UUID: ''
}]);
How can I bind an individual property of transactionArray, such as EnvNum to my
model, detailObject
<model:Tithesgifts_d id="detailObject">
<model:ContribNum>{this._key as
String}</model:ContribNum>
<model:EnvNum>{Number(subTransEnvNum.itemToLabel(this))}</model:EnvNum>
<model:DateTrans>{subTransDateTrans.itemToLabel(this)
as Date}</model:DateTrans>
<model:Currency>{subTransCurrency.itemToLabel(this)
as String}</model:Currency>
<model:CheckNum>{Number(
subTransCheckNum.itemToLabel(this))}</model:CheckNum>
<model:Fund>{subTransFund.itemToLabel(this)
as String}</model:Fund>
<model:Amount>{Number(subTransAmount.itemToLabel(this))}</model:Amount>
<model:Comment>{subTransComment.itemToLabel(this)
as String}</model:Comment>
<model:TransID>{subTransTransID.itemToLabel(this)
as String}</model:TransID>
<model:UUID>{ subTransUUID.itemToLabel(this)
as String}</model:UUID>
</model:Tithesgifts_d>
this doesn't work, all the values come in as null. I was trying to pull the
values from the DataGridColumns, but that wasn't working for me here. Please
help! Thanks if advance.