1
嗨,我有一個簡單的(我認爲)的問題。我在Flex 4.6(部分代碼)中有以下自定義組件。在組件中分配arraycollection作爲數據網格在主應用中的數據提供
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:ArrayCollection id="acItems"/>
<s:ArrayCollection id="acOrder" source="{orderItems.source}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
[Bindable]
public var orderItems:ArrayCollection = new ArrayCollection();
private function addToOrder():void
{
orderItems.addItem(itemGrid.selectedItem);
}
]]>
</fx:Script>
<mx:AdvancedDataGrid id="itemGrid" dataProvider="{acItems}" width="100%" height="100%" borderVisible="false" click="addToOrder()">
<mx:columns>
<mx:AdvancedDataGridColumn width="200" dataField="omschrijving" headerText="omschrijving"/>
<mx:AdvancedDataGridColumn dataField="prijs" headerText="prijs"/>
</mx:columns>
</mx:AdvancedDataGrid>
因此,無論何時點擊某個項目,都會將其添加到arraycollection中。
現在我在我的主應用程序中調用這個組件。它充滿了來自數據庫的數據。這是所有工作正常,所以我不認爲代碼是需要解決我的問題:)
<components:Items acItems="{acItems}"/>
而旁邊這個組件,我在我的主要應用程序的另一個數據網格。這一個應該填充我在自定義組件中的arraycollection。但是我不知道如何將這個arraycollection作爲數據網格的數據提供者。有人有想法?