Spark DropDownList equivalent of the HTML optgroup tag

HTML’s select control included a tag called optgroup where you could group items in the drop down together and provide a heading that wasn’t selectable. This post looks at making an equivalent component in Flex 4 by extending DropDownList. Here’s an example of the HTML select control working on W3Schools. Notice that group headings [...]

You Might Also Like...

  • Displaying all items in a Spark DropDownList control drop down menu in Flex 4

    672 readersThe following example shows how you can display all items in a Spark DropDownList control’s drop down menu in Flex 4 by creating a custom DropDownList skin and removing the Scroller skin part. Thanks to Andriy Panas for the no Scroller suggestion in http://bugs.adobe.com/jira/browse/SDK-22614. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/02/10/displaying-all-items-in-a-spark-dropdownlist-control-drop-down-menu-in-flex-4/ --> <s:Application name="Spark_DropDownList_noScroller_test" [...]

  • Setting a roll over open delay on a Spark DropDownList control in Flex 4

    426 readersThe following example shows how you can set a roll over open delay on a Spark DropDownList control in Flex 4 by extending the DropDownList control, accessing the protected DropDownController object and setting the rollOverOpenDelay property. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/02/03/setting-a-roll-over-open-delay-on-a-spark-dropdownlist-control-in-flex-4/ --> <s:Application name="Spark_DropDownList_dropDownController_rollOverOpenDelay_test" xmlns:fx="http://ns.adobe.com/mxml/2009" [...]

  • Setting a roll over open delay on a Spark VolumeBar control in Flex 4

    500 readersIn a previous example, “Setting a roll over open delay on a Spark DropDownList control in Flex 4″, we saw how you could set a roll over open delay on a Spark DropDownList control in Flex 4 by extending the DropDownList control, accessing the protected DropDownController object and setting the rollOverOpenDelay property. The following example

  • Toggling the drop shadow on the Spark DropDownList control in Flex 4

    883 readersThe following example shows how you can toggle the drop shadow on the Spark DropDownList control in Flex 4 by setting the Boolean dropShadowVisible style. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/06/21/toggling-the-drop-shadow-on-the-spark-dropdownlist-control-in-flex-4/ --> <s:Application name="Spark_DropDownList_dropShadowVisible_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <s:controlBarContent> <s:CheckBox id="cb" label="dropShadowVisible" selected="true" change="cb_changeHandler(event);" /> </s:controlBarContent>   <fx:Script> <![CDATA[ protected function cb_changeHandler(evt:Event):void { ddl.openDropDown(); } ]]> </fx:Script>

  • Checking that an item is selected in the Spark DropDownList control in Flex 4

    569 readersThe following example shows how you can check whether the user has selected an item in the Spark DropDownList control in Flex 4 by setting the Boolean requiresSelection property to true or using a NumberValidator to check the DropDownList control’s selectedIndex property is greater than -1. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/03/12/checking-that-an-item-is-selected-in-the-spark-dropdownlist-control-in-flex-4/ --> <s:Application name="Spark_DropDownList_requiresSelection_test" [...]

  • Setting the horizontal scroll policy on a Spark DropDownList control in Flex 4

    954 readersThe following example shows how you can set the horizontal scroll policy on a Spark DropDownList control in Flex 4 by setting the horizontalScrollPolicy style on the drop down menu’s Scroller skin part. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/02/06/setting-the-horizontal-scroll-policy-on-a-spark-dropdownlist-control-in-flex-4/ --> <s:Application name="Spark_DropDownList_scroller_horizontalScrollPolicy_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]

  • Resizing a Spark DropDownList control to match the currently selected item in Flex 4

    522 readersThe following example shows how you can resize the Spark DropDownList control to match the currently selected list item in Flex 4 by setting the DropDownList control’s typicalItem property to the currently selected item. Full code after the jump. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/01/21/resizing-a-spark-dropdownlist-control-to-match-the-currently-selected-item-in-flex-4/ --> <s:Application name="Spark_DropDownList_typicalItem_test" xmlns:fx="http://ns.adobe.com/mxml/2009" [...]

  • Setting the border color on a Spark DropDownList control in Flex 4

    812 readersIn a previous example, “Setting the border alpha on a Spark DropDownList control in Flex 4″, we saw how you could set the border alpha on a Spark DropDownList control’s popup menu in Flex 4 by setting the borderAlpha style. The following example shows how you can set the border color on a Spark DropDownList

  • wlBetaPreview02

    WorkflowLab Beta Preview: Categories

    4344 readersWhen working with complex workflows, it can become difficult to visually discern different types of tasks from each other, or to have a way to group items as related to each other. With the WorkflowLab beta, we added custom categories that you can use to group and organize your tasks into customizable category names. By default,

  • Setting the border alpha on a Spark DropDownList control in Flex 4

    357 readersThe following example shows how you can set the border alpha on a Spark DropDownList control’s popup menu in Flex 4 by setting the borderAlpha style. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/03/20/setting-the-border-alpha-on-a-spark-dropdownlist-control-in-flex-4/ --> <s:Application name="Spark_DropDownList_borderAlpha_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]