Note that there are some explanatory texts on larger screens.

plurals
  1. POIssues with Spark DropDownList as itemEditor within AdvancedDataGrid
    primarykey
    data
    text
    <p>I'm trying to use the Spark <code>DropDownList</code> as <code>itemEditor</code> in an AdvancedDataGrid. Howerver, I've stumbled onto two issues:</p> <ol> <li><p>Clicking on a item in the DropDownList changes the selected row in the ADG. You can see this behavior by compiling the code from below and executing the following steps.</p> <ul> <li>Open the DropDownList by Clicking on "A" in Row 1</li> <li>Select "C" with your mouse</li> </ul> <p>The value changes from "A" to "C" and Row 3 is the selected row in the ADG. It looks like the mouse click in the DropDownList is also handled by the ADG itself which changes the selected row accordingly. I couldn't figure out a way to prevent this. The expected behavior would be that row 1 is still selected after the DropDownList has been closed.</p></li> <li>Clicking on the scrollbar of the DropDownList closes the DropDownList. (I just found the solution to this problem in the relatated questions while writing this: <a href="https://stackoverflow.com/questions/3506454/scrollbars-in-dropdownlist-inside-datagrid-itemeditor-not-working">Scrollbars in dropdownlist inside DataGrid itemEditor not working</a>)</li> </ol> <p>Application</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;s:layout&gt; &lt;s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/&gt; &lt;/s:layout&gt; &lt;fx:Script&gt; &lt;![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"}, ]); ]]&gt; &lt;/fx:Script&gt; &lt;mx:AdvancedDataGrid dataProvider="{myDataProvider}" editable="true"&gt; &lt;mx:columns&gt; &lt;mx:AdvancedDataGridColumn headerText="Label" dataField="label" width="150"/&gt; &lt;mx:AdvancedDataGridColumn headerText="Value" dataField="value" width="200" editorDataField="selectedItem" itemEditor="DropDownListEditor"/&gt; &lt;/mx:columns&gt; &lt;/mx:AdvancedDataGrid&gt; &lt;/s:Application&gt; </code></pre> <p>ItemEditor</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" focusEnabled="true" implements="mx.managers.IFocusManagerComponent"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.collections.ArrayList; import mx.collections.IList; [Bindable] public var values:IList = new ArrayList(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]); public function get selectedItem():* { return dropDownList.selectedItem; } public override function setFocus():void { dropDownList.setFocus(); } ]]&gt; &lt;/fx:Script&gt; &lt;s:DropDownList id="dropDownList" top="2" left="2" right="2" bottom="2" dataProvider="{values}" selectedItem="{listData.label}" open="dropDownList.skin['dropDown'].owner = this"/&gt; &lt;/s:MXAdvancedDataGridItemRenderer&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload