I think you want to call ModelLocator.currentDeal.addUnit( new UnitVO(
) ) to add a new unit.  Or, you could add a clone() method to your
UnitVO object and make sure you either pass the clone to addUnit() or
have addUnit() explicitly clone the object before adding it to the
array.  What you have now is probably adding the same object reference
that you then clear out. 

Doug

--- In [email protected], "Jonathan Willis" <[EMAIL PROTECTED]> wrote:
>
> I've got a DataGrid (Flex 1.5) bound to an Array of Objects (custom data
> classes containing a known number of properties, specified in the
columnName
> attributes of my DataGridColumns).  If the Array is populated when the
> DataGrid is loaded, the items display as expected.  If I add a new
item to
> the dataProvider, a new row is added to the DataGrid but it's completely
> blank.  I get the same result if the Array is not populated on load
and I
> add a new item.  I can click on the row and my keyUp event will
fire, but
> there's just no data displaying.
> 
> Example code follows (thanks in advance for the help):
> <mx:DataGrid dataProvider="{ModelLocator.currentDeal.units}">
>       <mx:columns>
>               <mx:Array>
>                       <mx:DataGridColumn columnName="unitType"
> editable="false" headerText="" sortable="false"/>
>                       <mx:DataGridColumn columnName="unitYear"
> headerText="Year" sortable="false"/>
>                       <mx:DataGridColumn columnName="unitMake"
> headerText="Make" sortable="false"/>
>                       <mx:DataGridColumn columnName="unitModel"
> headerText="Model" sortable="false"/>
>                       <mx:DataGridColumn columnName="unitCondition"
> headerText="New/Used" sortable="false" />
>               </mx:Array>
>       </mx:columns>
> </mx:DataGrid>
> 
> var unitData:UnitVO = new UnitVO( );
> 
> /**
>  * @description       Adds unit currently displayed in fields below grid
to the
> current deal
>  *                    and re-initializes unitData to take another unit
> from entry form.
>  * @usage             <code>addButton.click="addUnitToList( )"</code>
>  */
> function addUnitToList():Void
> {
>       // Add new unit and clear out unitData
>       ModelLocator.currentDeal.addUnit( unitData );
> 
>       unitData = new UnitVO( );
> }
>







--
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to