In gotCHeckData, It looks like you're working on a local var

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of David C. Moody
Sent: Thursday, May 22, 2008 10:12 AM
To: [email protected]
Subject: [flexcoders] Add New Item to Datagrid

 

Hi,

I'm having trouble. I have done this before, and it is actually 
running in a program now. But for the life of me I can't make it 
work again.

I'm using Alex Harui's method:
http://blogs.adobe.com/aharui/2008/03/custom_arraycollections_adding.h
<http://blogs.adobe.com/aharui/2008/03/custom_arraycollections_adding.h>

tml

Here's my AS code:

private function generateObject():Object {
return { account: "" }
}

private function isObjectEmpty(obj:Object):Boolean {
return obj.account == "";
//return obj.employee == "" & obj.reason == "";
}

private function gotCheckData(evt:ResultEvent):void {
var ac:NewEntryArrayCollection = new NewEntryArrayCollection 
(evt.result as Array );
ac.factoryFunction = generateObject;
ac.emptyTestFunction = isObjectEmpty;
ckData.dataProvider = ac;
//ckData.dataProvider = evt.result;
}

Here's my DataGrid:
<mx:DataGrid x="10" y="245" width="560" height="204" id="ckData" 
editable="true">
<mx:columns>
<mx:DataGridColumn headerText="Account" 
dataField="account" width="75" 
itemRenderer="com.coachflex.objects.PlaceHolderItemRenderer"/>
<mx:DataGridColumn headerText="Description" 
dataField="description" editable="false"/>
<mx:DataGridColumn headerText="Amount" 
dataField="amount" width="75" />
<mx:DataGridColumn headerText="Tour #" 
dataField="tour_num" width="75" />
<mx:DataGridColumn headerText="Use Date" 
dataField="use_date" width="75" />
</mx:columns>
</mx:DataGrid>

The Datagrid is completely empty. I can edit the blank rows, but it 
should have data in it.

If I comment out the NewEntryArrayCollection stuff and just have 
ckData.dataProvider = evt.result;

My data shows up. Why can I not see current data?? This is blowing 
my mind as I have it working in another program.

The recordset has the following columns:
recnum, tour_num, use_date, account, amount, description

Thanks in advance!!

 

Reply via email to