Drop Down List - Setting the Default Selected Item

I have a drop down list in my application that gets populated by a remote database.  When you select an item from the list, a screen full of thumbnails is populated based on the selection.  We have decided that when the user gets to this component in our air application, that it looks too empty and barren.  All that displays is a drop down list with an empty screen.  So we would like to set a default setting for the drop down list so that when the user gets to this component, a screen full of thumbnails is awaiting them and they can change it if they want.  My first instinct was just to set the selectedIndex property of the drop down list to the value that we want as the default, and that works, but it only changes the label in the dropdownlist, it doesn't actually populate the screen with the thumbnails.  That is because when an item is selected, it has to be commited to the drop down list by a CLOSE event that then sets off the close handler that populates the screen with thumbnails.  So after looking at the documentation, I found that there is a method called closeDropDown that states the following:
closeDropDown
method
public function closeDropDown(commit:Boolean):void
Close the drop-down list and dispatch a DropDownEvent.CLOSE event.
Parameters
commit:Boolean — If true, commit the selected data item.
When I use this method, nothing happens.  In fact if I add a listener for the CLOSE event, the close event isn't getting fired.  So I am a little befuddled.  The only thing that I can figure is that I am setting the selectedIndex and not the selectedItem before I call the closeDropDown method, and if you look above, the documentation vaguely states that that "If true, commit the selected data item".  Do I need to set the selectedItem and not the selectedIndex?  If so, I am not exactly sure how to do this since I am using a service to populate my drop down list which kind of makes the dataprovider a little unclear to me in the code because it gets replaced by an AsyncListView.  Here is what I have.
<fx:Script>
     <![CDATA[
        protected function dropDownList_creationCompleteHandler(event:FlexEvent):void{
          getAllAudio_descriptionsResult.token = audiodescriptionsService.getAllAudio_descriptions();
          getAllAudioResult.token = audioService.getAllAudio();
     private function audioDescriptionsCallResponderHandler(event:ResultEvent):void {
          audioDesc = event.result as ArrayCollection;
     private function audioCallResponderHandler(event:ResultEvent):void {
          audio = event.result as ArrayCollection;
          audioDescDropDown.selectedIndex = 2;
          audioDescDropDown.closeDropDown(true);
     ]]>
</fx:Script>
<fx:Declarations>
     <s:CallResponder id="getAllAudio_descriptionsResult" result="audioDescriptionsCallResponderHandler(event)"/>
     <audiodescriptionsservice:AudiodescriptionsService id="audiodescriptionsService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
     <s:CallResponder id="getAllAudioResult" result="audioCallResponderHandler(event)"/>
     <audioservice:AudioService id="audioService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
</fx:Declarations>
<s:DropDownList id="audioDescDropDown" x="43" y="65" width="185" height="34" fontFamily="MyriadProSemiBold"
                    fontSize="15" skinClass="skins.VideoSkins.Video.DropDownSkin"
                    color="0xE6E6E6" selectionColor="0x054F7C" rollOverColor="0x007CBA"
                    creationComplete="dropDownList_creationCompleteHandler(event)" labelField="audioCatName"
                    itemRenderer="renderers.DropDownList3" close="DDLAudioCloseHandler(event)">
     <s:AsyncListView list="{getAllAudio_descriptionsResult.lastResult}"/>
</s:DropDownList>
I would really appreciated hearing from anyone who has experience or insight into setting a default for a drop down list and actually forcing it to execute that default selection.  Any thoughts at all would be helpful.  Thanks!

I don't see your close handler in the code you posted, so if you provided it and I missed seeing it, please forgive me.  I'm a bit unclear on why the open and close of your dropdown list is so critical to your functionality.  It seems to me that the page of data would be tied to the item selected in the drop down (which to my mind is the only purpose for the drop down to be there).  So why do you first need to open and close the drop down, rather than just taking the selected value and doing whatever you'd normally do with it to populate that page?
What I'm getting at is that I'd expect that page to be a separate component that would just have a property for the selected "thing", and that you could populate it either manually, as I suggested, or through the close handler on your drop down--I wouldn't think that there should be a need to go through the close handler every time.  Even if you don't have it implemented the way I'm thinking, you may want to think about whether you need to go through the close handler every time, or whether you could break it out so that the close handler simply determines which item to select, then jumps to another function that actually does something with the selected value.  That way, you don't have to go through the overhead of opening and closing the drop down if you need to change its value programmatically.
HTH;
Amy

Similar Messages

  • How to show first parameter value in drop down list as a default value dynamically in ssrs report?

    Hi,
    in my ssrs report i have two parameters, accounts and Manager ,there is a cascading between the accounts parameter and manager parameter, as per the cascading we will get managers names based on the account we selected in the accounts parameter,
    my requirement is the first name in the mangers drop down list  has to get selected as default value.
    please help me with this, it is an urgent requirement.
    Thanks in advance,
    Naveen

    Hi NaveenMSBI,
    According to your description, you want to use cascading parameters in the report, if the accounts are selected when you preview the report, the first manager name will be selected from drop down list as the default value. If so, there can be two scenarios:
    • If manager is single-valued parameter, we can get Available Values and Default Values from the same query as below. Then when the accounts are selected, the first manager name will be selected as default value.
    SELECT managerName FROM table_name WHERE accounts IN (@accounts)
    • If manager is multi-valued parameter, we need to use different query for Available Values and Default Values. In this case, please refer to Patrick’s solution.
    For more information about Adding Cascading Parameters, please refer to the following document:
    http://technet.microsoft.com/en-us/library/aa337498(v=sql.105).aspx
    If you have any questions, please feel free to let me know.
    Best Regards,
    Wendy Fu

  • In Firefox 4, how do I get back the context menu for the drop down list of the Location Bar so I can Open Link in New Tab, which I did often in FF 3?

    Firefox 3 has a context menu for the drop down list of
    the Location Bar. One option on this menu I used often
    is "Open Link in New Tab" -- quite convenient.
    This context menu has disappeared in Firefox 4.
    Can I get it back?

    See also:
    *Tools > Options > Privacy > History: "Remember search and form history"
    *https://support.mozilla.org/kb/Form+autocomplete
    The "Use custom settings for history" setting allows to see the current history and cookie settings, but selecting that setting doesn't make any changes to history and cookie settings.<br />
    Firefox shows the "Use custom settings for history" setting as an indication that at least one of the history and cookie settings is not the default to make you aware that changes were made.<br />
    If all History settings are default then the custom settings are hidden and you see "Firefox will: (Never) Remember History".<br />

  • Custom drop down list for the filter for BEX report

    Hi, all:
    I am writing a query for a BEX report that prompts the user to enter a value for a field "GL account".  I would like to have the user select from a limited number of GL options rather than have the whole Chart of accounts show up. Is there a way to make a "custom" drop down list for the filter?
    Thanks!
    Jenny

    You need to make your GL account info object as an authorization object. And in the info object ,for BEx you need to select the option "only authorized values".
    Create an analyis authorization on gl account and assign the restricted set of GL accounts to the user. Asign this analysis authorization to the user.In the query restrict this infoobject with an authorization variable. This would solve your purpose.user would be able to see only a selected set of GL accounts for which he is authorized.

  • Getting the rawValue of a Drop-Down list on the "change" event

    I am having problems getting the rawValue of a Drop-Down list on the "change" event. It seems that you have to select the same item twice in a row to get the rawValue to be the value of the selected item.
    ::dropdownlist onChange event::
    xfa.host.messageBox(this.rawValue);
    On the first time a value is selected you get 'null'. The second time the same value is selected, you get the selected value.
    Does anyone have any thoughts on why this is happening? Also, I CANNOT use xfa.event.newText, I need to use the rawValue of the dropdownlist.
    Thanks

    The change event occurs before the rawValue is changed. If you NEED to use the rawValue you'll need to use a later event. Perhaps you could use exit so that it gets triggered when the field loses focus?
    Chris
    Adobe Enterprise Developer Support

  • Urgent!How to set the default selected date for an OAMessageDateFieldBean

    Hi,
    There is messagetextinput on the page.the dataType is Date.
    if I do not input anything on this messagetextinput ,when I click on the date icon,the default selected date is today.
    But I want to set the default selected date base on another messagechoice.
    Is that possible?
    binghao.

    Sumit/Binghao,
    When u set deafult date in the OAMessageDateFieldBean, the OAInlineDatePickerBean (which are referring as datepicker popup windows), takes the default value from OAMessageDateFieldBean.
    If you explore OAMessageDateFieldBean in framework, u will find its nothing but a onClick js event is called on the imageicon attached with messagetextinput bean(in case the type is Date) and OAInlineDatePickerBean is opened in a modal js window.
    So, here is code for setting default value both in both in OAMessageDateFieldBean and OAInlineDatePickerBean :
    OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)webBean.findIndexedChildRecursive(<item id>);
    dateField.setValue(pageContext,new Date(100, 06, 04)/* 4th July 2000*/);
    One more important thing, here Date class is java.sql.Date.I hope i am clear.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I change the order in the drop down list of the teamviewer

    HI all
    If I can change the order in the drop down list of the teamviewer?
    example the default is "Direct Reports",I want to change it to the "Employees in Organizational Structure".
    Best Regards

    Cui,
    It is based on OADP. goto SPRo - Integration with other mySAP.com components - business packages/functional packages- manager self services()-Object and data provider-
    Thanks
    Bala Duvvuri

  • How to set the default selection to "Select All" in a Multi valued parameter in SSRS 2008?

    Hello Everyone,
    How to set the default selection  to "Select All" in a Multi valued parameter in SSRS 2008?
    Regards
    Gautam S
    Regards

    You need to specify "Default Values" in the report parameter property. Choose similar option used in the "Available Values" option, this will allow the parameter to check "Select All".
    Regards, RSingh

  • How to add Check box to a static Drop down list (bases on a selection list) and allow mulity select in it?

    Dear All,
    I created a text field in my project (Light switch 201, C#), this text field has a static list which I filled manually. when I click in this text box I get a dropp down list which allow me to chose only one value from it.
    Now what I want to do is to add a check box in this drop down list and allow mulity selection from this list. My list looks as follow:
    Can anyone help me :) ? 
    Thanks all,
    Zayed

    Something like this:
    http://www.codeproject.com/Tips/452756/Add-checkbox-inside-combobox-in-Silverlight

  • Firefox 3 used to have a drop down list under the back button for recent pages. How do I get this in FF4?

    FF3 used to have a drop down list of the most recent pages that a tab had displayed under the back arrow button. FF4 does not appear to have this. How can I see history of what's been displayed in the tab say four or five pages back?

    You can get the drop down list by either right-clicking on the back/forward buttons, or holding down the left button until the list appears.
    If you want the drop-down arrow you can add it with the Back/forward dropmarker add-on - https://addons.mozilla.org/firefox/addon/backforward-dropmarker

  • How to set the default selected option as NO_OPTION in a JoptionPane

    This is just an example program to create the same scenario in the project.When clicked on OK button, it will pop up a JOptionPane confirm dialog with YES-NO buttons.I want to set the default selected button as NO button. In the below program, the keyboard focus is set on NO button, but in the look and feel the selection is still YES button. Can anyone suggest a solution to make both the focus on NO button?
    public class Test extends JPanel implements ActionListener{
         Test() {
              JButton btn = new JButton("OK");
              this.add(btn);
              btn.addActionListener(this);
         public void actionPerformed(ActionEvent e) {
              Object[] o = {"Yes", "No"};
              JOptionPane p = new JOptionPane("Are u sure?",JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_OPTION,null,o,null);
              //p.setWantsInput(false);
              p.setInitialSelectionValue(o[1]);
              try {
                   UIManager.setLookAndFeel(new MetalLookAndFeel());
              } catch (UnsupportedLookAndFeelException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              //p.setFocusCycleRoot(false);
              p.setInitialValue(o[1]);
         //p.getRootPane().getDefaultButton().requestFocusInWindow();
              UIManager.put("Button.defaultButtonFollowsFocus", Boolean.FALSE);
              p.createDialog(this, "").setVisible(true);
              if(p.getValue() == o[0]) {
                   System.out.println("yes");
              }else if(p.getValue() == o[1]) {
                   System.out.println("no");
              //p.setWantsInput(true);
              //p.showConfirmDialog(this, "Are u sure?");
              //p.setInitialSelectionValue(new Integer(JOptionPane.NO_OPTION));
         public static void main(String[] args) {
              Test t = new Test();
              JFrame f = new JFrame();
              f.getContentPane().add(t);
              f.pack();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.setSize(500, 500);
              f.setVisible(true);
         }

    not sure what you're trying to do, but try this
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Test extends JPanel implements ActionListener
      Test()
        JButton btn = new JButton("OK");
        this.add(btn);
        btn.addActionListener(this);
      public void actionPerformed(ActionEvent e)
        Object[] o = {"Yes", "No"};
        int value = JOptionPane.showOptionDialog(null,"Are u sure?","",-1,-1,null,o,o[1]);
        if(value == 0) System.out.println("yes");
        else if(value == 1) System.out.println("no");
      public static void main(String[] args)
        UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
        Test t = new Test();
        JFrame f = new JFrame();
        f.getContentPane().add(t);
        f.pack();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(500, 500);
        f.setVisible(true);
    }

  • Hide id from drop-down list at the top of the detail tab

    Hello Nakisa experts!
    I have one more question about Nakisa OrgChart 4.0 SP 1.
    How can I hide position and org unti id from drop-down list at the top of detail tab, see picture below:
    Thanks in advance.

    I'm not sure you're going to be able to change this.  I think (but I'm afraid I don't know for sure) the section is defined by \WEB-INF\uitemaplates\com\nakisa\manager\omg\ui\subucs\sectionDesigners\DetailHistoryButtonSectionSubUC.xhtml, which after a quick search through the application looks as though it might be populated by a NakisaTrollBin.jar ... which isn't really something you should be looking to edit.
    Nakisa do often write in various settings that can allow features to be tweaked and enabled/disabled.  It could be that there's something you could add into SettingsResources to apply the change you require, but you would need to contact Nakisa about this as they don't document all of these options.
    All this being said I would query why this is being done.  It is not uncommon to say have multiple positions with the same name - e.g. HR Administrator might exist in several org units.  If you are looking through several identically named org units or positions, the unique identifier is going to be the object's ID.  As such it seems most logical to me to keep the ID in the history to allow a user to discern the difference between identically named positions/org units.
    Regards,
    Stephen.

  • BUG: Sorting drop-down lists from the field tab when using "specify item values"

    Hi all,
    I've finished creating my form now, but I came across this whilst writing up my documentation for maintenance tasks.
    This occurs when adding new values to a drop-down list that has the "Specify item values" checkbox in the binding tab checked.
    When I then try to sort my list using the built in sort buttons, it will sort the items, but the list of specified values in the binding tab does not sort reorder to stay with the original items in the list.  This is hapenning when I sort from the Object > Field tab.  If I sort in the Object > Binding tab then the sort will include the specified values.
    For example:
    A    5
    C    2
    D    9
    Add a new value to get:
    A    5
    C    2
    D    9
    B    10
    Sort the list using the button:
    A    5
    B    2
    C    9
    D    10
    But it should be:
    A     5
    B     10
    C     2
    D     9

    I was able to duplicate this problem and it looks like a possible bug.  I've submitted it to support.

  • How do I remove an entry from the "Store Files" drop down list in the "Import Settings" section of Aperture 3.3.2

    The dropdown list "Store Files" in the "Import Settings" section of Aperture 3.3.2 displays the history of the entries previously added to the list. Some of the entries are no longer valid and I'm trying to delete them but I can't find a way to do this. This is a screenshot. Does anyone know how to do this?

    Once again - the Jive system ate my bullet points and messed up the formatting
    Is the MacOS X version in your signature correct? Then you cannot be using Aperture 3.3.2?
    You should not be seeing duplicate entries in the "Store Files" pop-up menu. This looks like your Aperture Preferences file is corrupted and needs fixing.
    Quit Aperture (and log off and on again, if you are running MacOS X 10.7 or later)
    Then reveal your User Library (from the Finder's main menu bar, the "Go" menu. Hold down the options-key until the library apears in the drop-down menu)
    In the Library folder select the "Preferences folder and locate the file "~/Library/Preferences/com.apple.Aperture.plist"
    Now you can either
    remove the com.apple.Aperture.plist file to the Desktop, to force Aperture to create a new one, but you will have to set again your Preferences from the "Preferences" panel,
    or make a backup copy of the file and edit it, if you are an experienced programmer and have Xcode installed. To fix the drop-down list you need to edit the item "RecentReferenceFolders" and delete the redundant folder names. Enter "recent" into the search field to find it quickly. If you click an item in the list, plus/minus buttons should appear. But only try this, if you know how to edit property lists, otherwise it will be much safer to delete the faulty list and to set your preferences again from the "Preferences" panel.
    Regards
    Léonie

  • How can I select from drop-down list and jumping to selected subform?

    I using LC Designer ES2 vers 9. Developing XDP. How can I Select from a drop-down list the appropriate selected subform (jumping to the selected subform on the page)?
    drop-down list...A (jump to subform1)
                             B (jump to subform2)
                             C (jump to subform3)
    subform1
    subform2
    subform3
    ....end of form

    Hi,
    you cannot set focus on a subform but on a field, as only interactive objects can be focussed.
    From a dropdowns exit event the script will look this way:
    switch (this.rawValue) {
              case "A" : xfa.host.setFocus("form1.page2.field1"); break;
              case "B" : xfa.host.setFocus("form1.page2.field1"); break;

Maybe you are looking for

  • Can't use the credit on my Apple ID

    I have purchased a 25$ credit gift card and redeemed it to my Apple ID account on iTunes, but can not purchase anything with it.  When I try to buy a song, the Store requests billing information.  I have used these cards beofre and never had a proble

  • 2006-004 Mac OS X 10.4.7 update crashed Macbook

    Hi, today i was installing the newest 2006-004 Mac OS X 10.4.7 update for my macbook, and it was installing it, and midway it said cannot install, and it told me that it was going to put it in the trash and i quit. after that i started having problem

  • SQL Query on an XMLObject CaseSensitive Resultset

    Hi there, I make a SQL query on an object with dbtype = query <cfquery name="qry_catalog" dbtype="query"> SELECT * FROM catalog query WHERE country LIKE '# art #' </ cfquery> What also goes without problems, interestingly, the query takes only result

  • 2 mail accounts, emails marked a read when not

    Hi, I have latest mac os and using mac mail. I have 2 accounts and I have similar mail sent to both accounts. When I read an email in one account it registers as read in the other as well. I don't want this to happen. How do I set mail, I can't find

  • Photo update (10.10.3) destroyed my albums!

    Can I get my albums back the way they were?