ComboBox - trying to set the selected item

I call a remote object that calls the following function to the suite. The returned object is used to fill a form of TextInputs and a ComboBox control - this is a form of change. How can I set the selected item in the ComboBox? I could not get the selectedItem to work, and I do not know the value of the index that corresponds to selectedCompany.CompanyType in order to use selectedIndex.

private void receiveSelectedCompany(event:ResultEvent):void {}
selectedCompany = event.result as business;

copy the record in the areas of publishing
txtCompanyId.text = selectedCompany.CompanyID.toString ();
cboCompanyTypeEdit.selectedItem.CompanyType = selectedCompany.CompanyType;
txtCompanyName.text = selectedCompany.CompanyName;
txtCompanyShortName.text = selectedCompany.CompanyShortName;
txtTaxId.text = selectedCompany.TaxID;
}

Thanks in advance,
France

FranceC, here is a function allows you to do.

simply call the selectComboValue function and pass it the name of the combobox and the search string as follows:

selectComboValue (Mazonedelistederoulante, dataObj.fieldName.toUpperCase ());

Here's the function:

public void selectComboValue(select:_mx.controls.ComboBox,_optionToSelect:String):void {}
for (var i: int = 0; i< select.dataprovider.length="" ;="" i++)="">
If (select.dataProvider.getItemAt ( ) .label == optionToSelect) {}
select.selectedIndex = i;
break;
}
}
}

PS: If you are looking for the data rather than on the label simply change this line:
If (select.dataProvider.getItemAt (
) .label ==)
to do this:
If (select.dataProvider.getItemAt ( ) .data == )

Tags: Flex

Similar Questions

  • How to detect when the selected item ObjectListField changed?

    I expanded the ObjectListField to implement a scroller of marquee style iPod for long lines of text that will disappear from the screen. So far, I have everything works well, and it works as I expect... when it fires.

    I'm having a problem to find a way to make reliable activate. It doesn't seem to be any method I can substitute or any earpiece I can use that fires when the current list item is changed. I first tried setSelectedIndex substitution. That worked sometimes, because apparently the OS is not call setSelectedIndex when he wants to change the item selected, it does something else.

    Then I tried the substitution of navigationMovement and manually call the code to start the timer, but that no longer works (I was the substitution of method navigationMovement of the ListField, maybe I should have done the Manager instead?). But anyway this approach does work for the version of the storm of my application because the storm never calls navigationMovement.

    Then I tried to use a fieldChangeListener, but apparently who don't get fired for the selection.

    Finally in despiration I tried substitution of drawListRow, only qualifying when index equals the selectedRow. But my code of scroll calls invalidate, so of course it just causes a loop infinite drawListRow, slow down the device and not even starting the scroll, because whenever the timer is started, it cancels the old one.

    Anyone have any ideas on what I can do here? Thank you.

    Good end I could not fieldChangeNotify to the fire, no matter which I overrided, even with the first setting the listener. It only seems fair to shoot during the selection change event. One thing to note, I use an objectlistfield, not an ObjectChoiceField... maybe you are thinking as well to another area?

    Thanks for the help anyway, in the end I was able to get the desired effect by modifying the code slightly to reuse the same animation timer rather than create a new one when the selected item changes. The timer is started in the constructor of the ListField. Works very well.

  • Determine the index of the selected items in a ListBox?

    Hello

    I can't find a simple/direct method to determine the index of the selected item in a list box.

    I feel I'm missing something, but I can't seem to figure out who (if any) returns an index number if you use it with the recall of .onChange for a ListBox control.

    The following code implements that I need, but is not particularly efficient or elegant and can get confused if you introduce multiple lists to check.

    Any suggestions to reproduce this behavior, even with the best code would be appreciated.

    Thank you!

    var RES = ' palette {text: 'Example-list' properties: {resizable: true}-} ".

    NLP: Panel {orientation: 'row', preferredSize: [400 600]------}

    list1: ListBox {preferredSize: [400 550], properties: {multiselect: true, numberOfColumns:2, showHeaders:true, columnTitles: ["list 1", "item 0"]}}, \

    }}"

    var win = new Window (res)

    Win.Show)

    for (i = 0; i < 10; i ++) {}

    var line = win.pnl.list1.add ("point", "Same entry")

    row.subItems [0] .text = ' paragraph '+ i}.

    Win.PNL.List1.OnChange = function() {}

    var tempArray = new Array()

    for (i = 0; i < win.pnl.list1.items.length; i ++) {}

    If (win.pnl.list1.items [i] .selected == true) {tempArray.push (i)}

    }

    selectedRow = win.pnl.list1.items var [tempArray [0]] .text

    var selectedRowSubitem = win.pnl.list1.items [tempArray [0]] .subItems [0]

    Alert ("selection:" + tempArray + "\n posted content:" + selectedRow + "\t" + selectedRowSubitem)

    }

    .. .in the same time, that should be enough

    win.pnl.list1.onChange = function() {
         alert(this.selection.index); // for this to work set, multiselect:false
    }
    

    I guess you already tried and the result is 'undefined', the reason is that you have this property

    multiselect:true
    

    in this case, the selection returns an array

    this.selection[0].index;
    

    I'd give you the first selected item, even if you only have a single element selected, for all selected items to loop through all the elements in the selection table.

    not sure if the wonderful guide Peter explains this (explained in the Guide to the tools), but you should read it too, he has tons of info.

  • Cant' import images of Photos because "it is not enough free space on the volume of your library to import the selected items.

    Hey guys,.

    So I tried to import some ~ 8 GB of photos on my mac, but the Photos app gives me the following message: "there isn't enough free space on the volume of your library to import the selected items. It is estimated that you need at least X.XX GB of additional free space. »

    Where X.XX represents the amount of GB it says that I need but it changes everytime that I reopen the application to attempt an import.

    My mac has currently 44.4 GB so I don't know why this issue is coming.

    Any help would be great!

    Thanks in advance,

    Andres

    Where is your library?  If it's on an external HD and how the drive is formatted?

    Have you tried to repair the library according to this document from Apple: library of your repair?

    What version of PHotos do you use?

  • setting the selection list values in the tabular presentation

    Hi all

    I have a form of a table with a column that contains lists of selection I need to set the values for all rows in the form of tables.
    I'm trying to set the values on the click of a button, but apparently not enough to work.

    Is there another way to do it, perhaps with javascript?

    Any help would be appreciated.

    Kind regards
    Cleo

    Cleo,

    He's working now, sorry I missed the fundamental thing that you try on a selection list and not entry, as says my above entry script...

    Just use this code

    $('select[name="f10"]').val('Y');
    
    //OR this if you need to loop through them
    
    function approveAll(){
       jQuery.each($('select[name="f10"]'), function(i) {
        this.value ='Y';
      });
    }
    

    It was me!

    Published by: VC on July 13, 2012 15:57

  • Retain the selected items on the right side of the shuttle in cascade

    Hello

    I'm under Apex 4.0.2 and have a cascading shuttle point so that a user can filter the left side of the shuttle using the text field.

    However when filter it - the shuttle seems to lose the items already selected on the right side.

    How can I change the element of the shuttle so that the user can always see the selected items, and the filter only works the unselected points (left side)?

    Thank you
    Keith

    Hi Keith,

    I don't have a blog, so there is no post. However, this is what I did:

    1 set the P298_FILTER element to 'Submit when you press enter' and added a branch to the page that redirected to the same page

    2. make the following settings for the P298_SHUTTLE element:

    Cascading LOV Parent article (s): P298_FILTER
    Page items to submit: P298_SHUTTLE
    List of values definition:

    SELECT ENAME d, EMPNO r
    FROM EMP
    WHERE UPPER(ENAME) LIKE UPPER(:P298_FILTER) || '%'
    OR '%' || :P298_SHUTTLE || '%' LIKE '%:' || EMPNO || ':%'
    ORDER BY UPPER(ENAME)
    

    and that is it really. The WHERE clause filters the record based on a filter match or a match with the existing items from the shuttle

    Andy

  • Failed to set the selected index of a ToggleButtonBar to "0".

    Hello:

    I have a problem with ToggleButtonBar.

    I put my toggleButtonBar with a viewStack with list of the VBoxes containing formItems. When the page loads for the firsttime, all right. The first button in the toggleButtonBar is selected with the correct formItem in the viewstack. I fill out the forms on each article and click on the submit button. It will take me to the homepage again. Next time when I click on a button to take me to the toggleButtonBar, the last selected button is selected with the form associated with that. I need to reset the togglebuttonBar to the first selection. I tried to set the selectedIndex property of toggleButtonBar and the viewStack to '0', but doesnot work.

    Someone at - it immediate help would be highly appreciated.

    Happy to help you. Maybe my post being the answer does not appear yet, but if you forgot to mark my poist as the answer, that would be appreciated.

  • COMBOX Box not displaying the selected item

    Here is the code I use to try to capture and display the selected item in a ComboBox control:

    private void changeProjectTypeSelection(event:Event):void {}
    projectTypeChange.text += event.currentTarget.selectedItem.cboProjectType + "" +.
    event.currentTarget.selectedIndex + "\n";
    }


    Then the ComboBox:
    < mx:ComboBox fontSize = "12" x = "93" y = "83" width = "110" id = "cboProjectType" dataProvider = "{projectTypeArray}" labelField = "projectTypeName" selectedIndex = "0" click = "changeProjectTypeSelection (event)" > < / mx:ComboBox >

    Then the TextInput:
    < mx:TextInput id = "projectTypeChange" "248,95" = x y = "84" width = "121" / >

    I know there is something wrong with ActionScript... just have not thought of it. Any suggestions would be greatly appreciated!

    Finally! Here is the solution:

    private void changeProjectTypeSelection(event:Event):void {}
    var i: int;
    for (i = 0; i<>
    If (projectTypeArray.getItemAt (i) .projectTypeName == event.currentTarget.selectedItem.projectTypeName) {}
    projectTypeChange.text = projectTypeArray.getItemAt (i) .projectTypeName;
    }
    }
    }

  • Name of the selected item in the tree

    Hi all..!

    I m new to Flex.
    I m using a tree control that uses XML as a data provider.
    I want to perform certain operations on the basis of the selected item in the tree. SelectedIndex tried but it didn't work the index coz changes when the nodes of the tree are drill down or drill upward.

    Can someone help me please... Its urgent

    Vishal :)

    Hello

    I modified the sample in the URL below to use the data you provided. Please check out if the sample code attached.

    http://livedocs.Adobe.com/Flex/3/langref/MX/controls/tree.html

    I hope this helps.

  • What does "an error occurred while trying to add the selected device: average 0xffffffce.»

    Hello

    "I'm in need of answers get the resolved message."

    "an error occurred while trying to add the selected device: 0xffffffce.

    This happens when I try to add my printer Epson WF 3640 in my queue via WIFI.

    Reset the printing on your Mac - Apple Support System

  • To access the selected items in a ListBox control

    In LabVIEW 2010, I have a ListBox control. How can I get a list of the objects that the user selected in the ListBox?

    I don't see any method, property or event that would provide this information.

    Thank you.

    The value of the ListBox are the indexes of the selected items.

    If you allow the user to select "0 or more' items, the data type will change in a table."

    To get the names of the selected items (I guess that is what you want), you should India property 'element names.

    Tone

  • Appearance of the selected item

    Overall, I like the appearance of the Explorer of Windows Vista.  However, when an item is selected, the color of the selected item is so light that it is (for me) almost not visible.  I can change the classic theme, but really prefer to make just the darker outline.  How would I go to do this?

    Hello

    Panel Setup/Customize/Windows color and appearance of the control, use the slider to increase the intensity. There is no additional controls beyond that for aero colors. Good luck, Rick Rogers, aka "Crazy" - Microsoft MVP http://mvp.support.microsoft.com Windows help - www.rickrogers.org

  • I tried to set the parental control and received this message: because this computer is connected to a domain, Parental controls are not available.

    I have the internet Charter.  I am a home user.  I tried to set the parental control and received this message: because this computer is connected to a domain, Parental controls are not available.  Again, I am a home user.  What does that mean?

    Hello

    1. which user account you are using for Parental control (Please note that you cannot apply parental controls on a user admin account? It can be applied to standard user only accounts)?

    2 have you made changes on the computer before this problem?

    I ask through the following article to find out how to set up Parental controls:

    http://Windows.Microsoft.com/en-us/Windows7/products/features/parental-controls

    http://Windows.Microsoft.com/en-us/Windows7/set-up-parental-controls

    After completing the above links persist issue please fallow the mentioned below of the methods.

    Method 1: Disable UAC (User Account Control) and check the result
    See http://Windows.Microsoft.com/en-us/Windows7/how-do-I-change-the-behavior-of-user-account-control-by-using-the-slider

    Note: You must restart your computer when you enable or disable UAC. Change levels of notification does not require that you restart your computer.

    Important: Enable UAC after you complete the steps.

    Method 2: If the problem persists, try to set the parental control in safe mode and check the result. If you are able to apply settings in safe mode, this means that some program is causing this problem, mainly the security software.
    See http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode  

    Hope the above information is helpful.

  • Clock on windows 8 is wrong time, I tried to set the time of the internet but its still not working, think theres a bug in the clock time, anyone have the same problem for windows 8 and know how to fix?

    Clock on windows 8 is wrong time, I tried to set the time of the internet but its still not working, think theres a bug in the clock time, anyone have the same problem for windows 8 and know how to fix?

    It sets obtained :-) Sorry for the delay

    Thank you very much! has worked perfectly!

  • get the values of the selected items to RichSelectManyChoice

    Hi all

    I have a RichSelectManyChoice

    When the user clicks on the "submit" button I want to get the values of the selected items...


    ----------------------------------------------------------page.jspx-----------------------------------------------------------------------------

    <? XML version = "1.0" encoding = "UTF - 8"? >

    " < = xmlns:jsp jsp:root ' http://Java.Sun.com/JSP/page "version ="2.1"xmlns:f =" " http://Java.Sun.com/JSF/core "

    ' xmlns:af = ' http://xmlns.Oracle.com/ADF/faces/rich "> "

    < jsp:directive.page contentType = text/html"; Charset = UTF - 8 "/ >

    < f: view >

    < af:document title = "untitled1.jspx" id = "d1" > "

    < af:messages id = "m1" / >

    < af:form id = "f1" >

    < af:panelGridLayout id = "pgl1" >

    < af:gridRow height = "100%" id = "gr1" >

    < af:gridCell width = '100% ' halign = "stretch" valign = "stretch" id = "gc1" >

    <! - content - >

    < af:selectManyChoice value = "#{bindings." CountriesView1.inputValue}.

    label = "#{bindings." CountriesView1.label}"id ="smc1.

    valuePassThru Binding = "#{suspect." Country}"="true">

    < f: selectItems value = "#{bindings." CountriesView1.items}"id ="si1"/ >

    < f: validator binding = "#{bindings." CountriesView1.validator} "/ >"

    < / af:selectManyChoice >

    < / af:gridCell >

    < / af:gridRow >

    < / af:panelGridLayout >

    < text af:button = "Button 1" id = "b1" action = "#{suspect.valide}" / >

    < / af:form >

    < / af:document >

    < / f: view >

    < / jsp:root >

    ---------------------------------------------------------------------------------------------------------------------------------------

    --------------------------------------------------------------------suspect.java-------------------------------------------------------------------

    package test.view;

    import com.sun.org.apache.xpath.internal.operations.String;

    Import oracle.adf.view.rich.component.rich.input.RichSelectManyChoice;

    public class suspect {}

    RichSelectManyChoice campaign private;

    String string = null;

    public suspect() {}

    ????????????????????????????????????????

    }

    public void valide() {}

    }

    {} public void setCountry (RichSelectManyChoice country)

    This.Country = country;

    }

    public RichSelectManyChoice {} getCountry()

    back country;

    }

    }

    ---------------------------------------------------------------------------------------------------------------------------------------------------------


    Anyone has an idea please?

    Hello

    You can use

    JUCtrlListBinding listBindings = (JUCtrlListBinding) getBindings () .get ("CountriesView1");

    Object [] str = listBindings.getSelectedValues ();

    for (int i = 0; i)< str.length;="" i++)="">

    System.out.println (STR [i]);

    }

    in this loop, you will get all the values of selectManyChoice, for details see Ashish Awasthi (Jdev/ADF) Blog: using the selection Multiple (component selectManyListbox & selectManyCheckbox) in ADF

    hope it helps

Maybe you are looking for