Selecting mulitple items in a List programmaticly

Hi everyone,
my list doesn't shows my updates if i select a item programmaticly.
this is an easy example showing my problem:
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayList;
            import mx.events.FlexEvent;
            [Bindable]
            public var array:ArrayList=new ArrayList();
            protected function view1_initializeHandler(event:FlexEvent):void
                array.addItem("item 1");
                array.addItem("item 2");
                array.addItem("item 3");
                array.addItem("item 4");
                array.addItem("item 5");
            protected function view1_creationCompleteHandler(event:FlexEvent):void
                list.selectedIndices.push(1);
                list.selectedIndices.push(2);
                list.selectedIndices.push(4);
        ]]>
    </fx:Script>
    <s:List width="100%" height="100%" dataProvider="{array}" allowMultipleSelection="true" id="list">
    </s:List>
The list doesn't show any selected items on prgramm start, but if i click for example item 3 or 5 which isnt in the selectedIndices array yet, item 1,2 and 4 becomes visual selected too. Seems like i have too tell the list somehow that it should check its selectedIndices vector if i select an item programmaticly.

thx that helped me ...
but i discovered that there is no need to create a new vector....
  list.selectedIndices.push(1);
                list.selectedIndices.push(2);
                list.selectedIndices.push(4);
list.selectedIndices=list.selectedIndices;
does it as well. im not really doeing anything here, but it seems like u have to call the setter "selectedIndices",  so that some bindings get triggered or some code in this setter gets active and commits the changes. a little bit strange but at least it works

Similar Messages

  • Programmatically select all items in a list

    Hi, I've been looking through the online docs trying to find
    a way to programmatically select all items in a list. I have a
    checkbox that when checked should select all items in a list. I
    found a method to clear all selections but not one to select all.
    Did I just miss it? Thanks!

    I don't know of any built-in functions to select all list
    items, but here is an example function to select all items in a
    list:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns="*" layout="absolute">
    <mx:Script>
    <![CDATA[
    [Bindable] private var people_xml:XML =
    <people>
    <person>Jen</person>
    <person>Brian</person>
    <person>Scot</person>
    </people>;
    private function select_all():void {
    var indices:Array = new Array();
    for (var i:uint = 0; i<people_xml.children().length();
    i++) {
    indices.push(i);
    peopleList.selectedIndices = indices;
    ]]>
    </mx:Script>
    <mx:Button x="125" y="10" label="Select All"
    click="select_all()"/>
    <mx:List x="10" y="10" allowMultipleSelection="true"
    dataProvider="{people_xml.person}" id="peopleList"
    labelField="person" width="107"></mx:List>
    </mx:Application>
    Vygo

  • How can I select an item from a list component with a seperate button

    This is a repost, I decided it'd probably be better here than
    in the general discussion board. I will try to delete the other
    one.
    Hello Everyone,
    This is my first post here. I am trying to figure out how to
    select an item within a list component with a button. This button
    is calling a function. I have searched for the past 3 hours online
    and I can't find anything about it. I thought perhaps I could set
    the selectedItem parameter, but that is read only, and I believe it
    returns an object reference rather than something like a number so
    even if i could set it, it would be pointless. I also found a get
    focus button, thought that may lead me somewhere, but I think that
    is for setting which component has focus currently as far as typing
    in and things like that. I am lost.
    Basically I am looking for a way to type this
    myList.setSelected(5); where 5 is the 5th item in the list.
    Any help would be much appreciated.

    Never mind found it. It is the property called selectedIndex
    and it is writable

  • Selecting a Item in horizontal list programatically

    Hi,
    I have multiple horizontal lists in a canvas and am trying to manage the focus between them.
    Am facing problems while I try to programatically select a item by setting the SelectedItem property to [0],
    can someone help me please!!
    kcb

    the following steps solved the problem:
    1) Setting the focus to the horizontalList using horizontallist.setfocus() method.
    2)Setting the selectedIndex property
    3) firing explicitly a key event for the horizontallist.
    I did not directly use the horizontal list , I extended the horizontal list class and added a public method which I can call to explicitly call the key event handler.

  • Key pressed in Jlist and selecting the item of key list accordingly

    Hi,
    I have a JList with the items in sorted order.Now I want that if a person presses any key (say K) then the first item starting with K should be selected.Hmmm I can do it by addding a key listener to the list and cheking all the items in the list ,by traversing through the whole lenght of JList and selecting the item if it starts with the character of the key pressed.
    But i was thinking if there is any better way to do that?
    Regards Amin

    see bugid: 4654916 - it does say that the the
    scrolling for the JList should now work with keyboard
    selection.I have the same problem. Thanx for the hint with the bugid. Saw a good workaround there with a simple subclass of JList. Works for me although it is annoying to subclass JList all the time. The bug seems not to be fixed in the 1.4.1 JDK.
    Andreas

  • How do i select multiple items in spark list without pressing the control ?

    Hi all,
    I need to change the list behavioral to enable multiple selections with a click on each item
    In list, instead of using the control
    10x
    elazar r

    In your itemClick handler, check the selectedItems property, and add to it. You might need to maintain a separate collection object and bind the selectedItems property to it.
    The question becomes how to unselect an item. If it is already selected, clicking it again can unselect it, and clicking a submit button or comparable action could do the same.
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.stardustsystems.com
    Adobe Flex Development and Support Services

  • Select multiple items from a list box as values for a parameter of crystal report and Oracle procedure

    -  I have a  Product list box (asp.net) used as multiple selected values for  a parameter. 
    - The Product ID is defined in the Oracle procedure as NUMBER data type. 
    -  In my crystal report, I have a parameter field allow multiple values as p_product_id type as Number.  This is the code in my Record Selection Formula for the report:
    ({?p_product_id}[1] = -1 OR {Procedure_name.product_id} in {p_product_id})
    -  In C#, this is my code
    List<decimal?> productUnit = new List<decimal?>();
    int counter = 0;
    decimal prod;
    for (int i = 0; i < lstProducts.Items.Count; i++)
                  if (lstProducts.Items[i].Selected)
                                if (decimal.TryParse(lstProduct.Items[i].Value, out prod))
                                    productUnit.Add((decimal?)prod);                              
                                    counter++;
           if (counter == 0)
                       productUnit.Add(-1);                      
    ReportingDAO rDataFactory = new ReportingDAO();
    retVal = rDataFactory.GetProductReport(productUnit);
    public CrystalDecisions.CrystalReports.Engine.ReportDocument GetProductReport(List<decimal?> productUnit)
              CrystalDecisions.CrystalReports.Engine.ReportDocument retVal = new rptProductDownload();
              ReportLogon rptLog = new ReportLogon();
             rptLog.Logon(retVal, "RPT_PRODUCT_DOWNLOAD");
             retVal.SetParameterValue("p_product_id", productUnit); 
    I keep having the "Value does not fall within the expected range" when I debug.  My question is, is the data type I used for procedure/Crystal report/ and C# correct ?  I always have problem with the data type.  Any help would be
    appreciated
    Thank you

    Hi progGirl,
    Thank you for your post, but Microsoft doesn't provide support for CrystalReport now. Please post your question in SAP official site here:
    http://forums.sdn.sap.com/forum.jspa?forumID=313
    Thank you for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to select multiple items when on safari?  Ex: when I have to choose countries where I have worked from a list.

    Hi Everyone
    Please advise: how do I select multiple items when on Safari? Ex. when I have to select multiple countries where I have worked.

    Hi Carolyn
    I am trying to select multiple items from a list on a particular website. I tried using the 'command' button, but to no avail.
    Grateful for any advice.

  • [WPF] AutoCompleteBox: oblige the user to select only items in list

    Hi,
    I'm using AutoCompleteBox from Codeplex.com
    Is there a way for oblige the user to select only items shown in list?
    I would avoid that user can to insert custom words in database.
    Thanks.

    Hi robertino_salemi ,
    In my experience, if you want to "avoid custom words and insert into database", I suggest that you could check these words before user inserts into database.
    I have made a code sample , suppose there is a button, it will check the value when click the button. you can refer to code below.
    You can also use the other event ,such as LostFocus,MouseLeave etc.
    <toolkit:AutoCompleteBox x:Name="autoTextbox" Width="150" Height="30" SelectedItem="{Binding}"></toolkit:AutoCompleteBox>
    <Button Width="100" Height="30" Content="submit" Click="Button_Click"></Button>
    List<string> ls = new List<string>();
    public MainWindow()
    InitializeComponent();
    ls.Add("abc" );
    ls.Add( "acc" );
    ls.Add("affc" );
    autoTextbox.ItemsSource = ls;
    private void Button_Click(object sender, RoutedEventArgs e)
    if(!ls.Contains(autoTextbox.Text.Trim()))
    MessageBox.Show("Error data!");
    return;
    Best Regards,
    Eoro

  • Copy more than one selected lists Item To anothers List(List Style is Tlist

    Hi
    Im working on developer 6i and i have two dynamic lists , i fill one of them With the Availabble database Users , so i want when i select
    one item from this list it goes to the other list
    how can i do that ?

    i populate the first list as follow
    Declare
    Stm Varchar2(700);
    Begin
              Stm :='SELECT SUBSTR(USERNAME,8,LENGTH(USERNAME)),SUBSTR(USERNAME,8,LENGTH(USERNAME)) FROM ALL_USERS ';
    Dynamic_list(stm ,'block.users_list');
    End ;
    and this is the function
    PROCEDURE Dynamic_List(Select_stm in varchar2,Itm varchar2) is
              rg_id      recordgroup;
              rg_name     varchar2(40) := 'LST_GRP';
              query_ok      number;
              cnt                    number;
    Begin
              rg_id     := find_group(rg_name);
              If not Id_Null(rg_id) then
              Delete_group(rg_id);
              End If;
    rg_id := create_group_from_query(rg_name,select_stm);
              query_ok := populate_group(rg_id);
              clear_List(itm);
              populate_List(itm,rg_id);
    Exception when others then
    Copy(sqlerrm,'FTR.ERR');
    END;

  • Programatically Select an Item in a JList

    Hi,
    I need to do this: Programmatically select an item in a JList.
    JList.selectItem(0) will select the item 0 in the model but it will NOT visually highlight the selected item in the list.
    Neither will ensureIndexIsVisible(0),
    I need to automatically select and item in a list (highlight that item as well)
    As if someone has clicked on that item with the mouse.. however they haven't you see, my program has done it, programatically.
    Please don't refer me to the beginners guide to java, or the API documentation, the answer is not there.
    Thanks

    Swing related questions should be posted in the Swing forum.
    Please don't refer me to the beginners guide to java, or the API documentation, the answer is not there.Yes it is.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Display all valid items and select multiple items

    Let us say I have valid items in table. For each purchase user can select few items from the list. I have to display all valid items from table and user should able to check items to buy. What is the best way we can implement this in forms.
    Thanks, lalitha

    For all the valid items you can create LOV as i understood then user can choose what he wants. But this sentence ti still confusing to me. Or what is the tricky things in you scanerio if only you have to show the valid item then use LOV.
    Lalitk wrote:
    and user should able to check items to buy.-Ammad

  • How do you select and move more than one bookmark at a time? Shift+Click does not select multiple items that are next to one another in a list because the item

    How do you select and move more than one bookmark at a time?
    Shift+Click does not select multiple items that are next to one another in a list because the items open in firefox before this happens.

    Use the bookmarks library. You may use Shift +Click, and Ctrl + Click to create groupings of selected bookmarks to drag and drop.
    * one method of opening the bookmarks library is keyboard shortcut <br /> Ctrl+Shift+B (Windows)
    *see also [[How to use bookmarks to save and organize your favorite websites]]
    *and [[Use bookmark folders to organize your bookmarks]]

  • Selecting items in column/list view copying them and pasting them to

    in the past (was it OS 9 ?????? ) i would be able to select all items in a folder
    if i had a long list of titles of files ( songs ) and copy to clipboard and then paste them to text edit and have that list handy for future reference. for example if i have a DVD with 100 photos. I want to keep a file of the names only. I used to be able to select all of them copy and then paste to a document. Cant do it in TIGER????? am i wrong?
    work arounds....

    Hi, Glenn.
    How this works now appears to depend on the application into which you are pasting the results.
    If I open a folder, Select All (Command-A), Copy (Command-C), and then paste into a TextEdit document, if the contents include PDFs it actually pastes all the PDFs into the document! Looks like a change in how this works.
    If I paste into a Carbonized text editor, like Tex-Edit Plus, it pastes the file names, as expected.
    Here's a workaround:
    1. Open the Macintosh HD > Applications > Utilities folder and Lunch Printer Setup Utility. You should see a printer icon in your Dock.
    2. Drag and drop the folder whose contents you want to save a listing of to the icon in the Dock.
    3. When the Print window displays, either:• Click Preview. A print preview of the FInder info for those files appears in Preview. If you like what you see, select File > Save As... and save the output.
    • Click the PDF pop-up button and select "Save as PDF" from the list. Follow the prompts from there to save the Finder info as a PDF file.The resulting PDF saves the list you desired.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Unable to select the value from a list item in forms 6i

    Hi ,
    I'am using forms 6i. I have created a list item in my form as below.
    Item_type = list item
    list style - popup list
    elements in list - A, B, C,D
    When I open the form all the above values are displayed for the list item. But I'am unable to select the item( either A,B,C,D).
    Please let me know if I need to add any thing else programatically to acheive this. The block on whixh these values are diplayed is a datablock.
    This is very urgent. Any suggestions would be of great help.
    Thanks
    Deepthi

    If you have a list item where you have:
    Display A value 1
    Display B value 2
    Display C value 3
    Display D value 4
    If want to initial the value of the item to be A, you can set the initial value of the item to 1 in the property pane.
    Otherwise in an initialisation triger have
    :block.list_item := 1;
    HTH
    Tony

Maybe you are looking for

  • Filevault corrupted. Can't log in. TM won't restore. Am I up a creek?

    Here's my situation: I run almost all of my data on filevault and I backup regularly with TM. I took mac into Apple Store to repair unrelated hardware problem. When it was returned, the tech said that the hard drive was corrupted and, at a minimum, I

  • Wireless speed conundrum

    I have two computers on a wireless network. A G4 running 10.3.9 is set up as the server, but changing that doesn't affect this problem. The other computer is a G5 running 10.4.8. Web browsing speed, email download speed, etc., is comparable on both.

  • Urgent: Problem regarding TREX NameServer

    Hi,     I installed TREX 6.1 on EP 6.0 SR1. When I tried opening TREXMonitor, it is giving me the following error: <b>    The name server is not running or no name server is configured in TREX Service Properties. Start J2EE Admin to change the proper

  • Rate Routings Partial Costing

    Need the help of this forum please.  We are a discreet manufacturing firm with specific operations for our products.  In many cases, we will perform an operation only a portion of the time, say 10% or 15%.  I'm trying to find a way to have the cost o

  • WS Registry/Repository

    Hi, does any of you guys have some experience with a sweet and nice open-source ws registry/repository that has some capabilities beyond uddi (ws-security, ws-policy, etc.)?