我想在AdvancedDataGrid中使用Spark DropDownList
作爲itemEditor
。 Howerver,我無意中發現了兩個問題:Spark DropDownList作爲AdvancedDataGrid內itemEditor的問題
點擊在DropDownList一個項目改變了ADG選定行。您可以通過編譯下面的代碼並執行以下步驟來查看此行爲。
- 打開通過從 「A」 到 「C」 和行3行點擊 「A」 1
- 選擇 「C」 用鼠標
值變化DropDownList的是在助理總幹事中選定的行。它看起來像DropDownList中的鼠標單擊也由ADG本身處理,ADG本身相應地更改所選行。我找不出預防這種情況的方法。預期的行爲是在DropDownList關閉後仍然選擇第1行。
- 單擊DropDownList的滾動條關閉DropDownList。 (我只是找到了解決這個問題的relatated問題在寫這篇:Scrollbars in dropdownlist inside DataGrid itemEditor not working)
應用
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var myDataProvider:ArrayCollection = new ArrayCollection([
{label: "Row 1", value: "A"},
{label: "Row 2", value: "B"},
{label: "Row 3", value: "C"},
{label: "Row 4", value: "D"},
]);
]]>
</fx:Script>
<mx:AdvancedDataGrid dataProvider="{myDataProvider}" editable="true">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="Label" dataField="label" width="150"/>
<mx:AdvancedDataGridColumn headerText="Value" dataField="value" width="200" editorDataField="selectedItem"
itemEditor="DropDownListEditor"/>
</mx:columns>
</mx:AdvancedDataGrid>
</s:Application>
的itemEditor
Greate有幫助。 – comphilip 2014-11-05 10:00:16