Multiple selection in List control using CheckBox as itemrenderer

Hey all,
            I am trying to get multiple selection working in a list control using the CheckBox as itemrederer but I am unable to get a list of selected indices even though I have multiple check boxes selected
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                layout="vertical">
    <mx:Script>
        <![CDATA[
            private function onChange():void
                trace(chkList.selectedIndices);
        ]]>
    </mx:Script>
<mx:ArrayCollection id="collection">
        <mx:Object label="Test A"/>
        <mx:Object label="Test B"/>
        <mx:Object label="Test C"/>
        <mx:Object label="Test D"/>
        <mx:Object label="Test E"/>
        <mx:Object label="Test F"/>
        <mx:Object label="Test G"/>
    </mx:ArrayCollection>
<mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox" change="onChange();" allowMultipleSelection="true"/>
</mx:Application>
I always get the last item I clicked
Thanks,
Firdosh

Hi there, I'll tweak your code a little bit to something like this:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                layout="vertical">
    <mx:Script>
        <![CDATA[
             import mx.events.ListEvent;
             import mx.controls.CheckBox;
           [Bindable]
           private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
            private function onChange(e:ListEvent):void
               if(CheckBox(e.itemRenderer).selected){
                         mySelectedIndexes.addItem(e.rowIndex);
               }else{
                              mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
               chkList.selectedIndices=mySelectedIndexes.toArray();
        ]]>
    </mx:Script>
<mx:ArrayCollection id="collection">
        <mx:Object label="Test A"/>
        <mx:Object label="Test B"/>
        <mx:Object label="Test C"/>
        <mx:Object label="Test D"/>
        <mx:Object label="Test E"/>
        <mx:Object label="Test F"/>
        <mx:Object label="Test G"/>
    </mx:ArrayCollection>
<mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
</mx:Application>

Similar Messages

  • How to handle multiple selection in the Spark List control with checkbox as itemrenderer?

    Hi All,
    I am using checkbox as an ItemRenderer in spark list.
    I have a query.
    how to handle multiple selection in the Spark List control with checkbox as itemrenderer?
    how to retrieve the selected item label?
    Thank you in advance.

    Hi there, I'll tweak your code a little bit to something like this:
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    layout="vertical">
        <mx:Script>
            <![CDATA[
                 import mx.events.ListEvent;
                 import mx.controls.CheckBox;
               [Bindable]
               private var mySelectedIndexes:ArrayCollection=new ArrayCollection();
                private function onChange(e:ListEvent):void
                   if(CheckBox(e.itemRenderer).selected){
                             mySelectedIndexes.addItem(e.rowIndex);
                   }else{
                                  mySelectedIndexes.removeItemAt(mySelectedIndexes.getItemIndex(e.rowIndex));     
                   chkList.selectedIndices=mySelectedIndexes.toArray();
            ]]>
        </mx:Script>
    <mx:ArrayCollection id="collection">
            <mx:Object label="Test A"/>
            <mx:Object label="Test B"/>
            <mx:Object label="Test C"/>
            <mx:Object label="Test D"/>
            <mx:Object label="Test E"/>
            <mx:Object label="Test F"/>
            <mx:Object label="Test G"/>
        </mx:ArrayCollection>
    <mx:List id="chkList" dataProvider="{collection}" itemRenderer="mx.controls.CheckBox"  itemClick="onChange(event);" allowMultipleSelection="true"/>
    </mx:Application>

  • Multiple selection in list item

    can i do multiple selection i list item using developer6(i), if yes, how?

    Hello,
    Please repost this question in the appropriate section of the Discussion Forum.
    This forum is for general suggestions and feedback about the OTN site.
    You can also use our new offering called OTN Service Network:
    For Oracle Advice/Minimal Support (fee based) on the Oracle Database Server, Oracle9i Application Server Containers for J2EE (OC4J), Oracle9i JDeveloper, Reports, Forums, SQL*Plus, and PL/SQL, please go to: http://www.oracle.com/go/?&Src=912386&Act=45
    For customers with paid support (Metalink) please go to:
    http://www.oracle.com/support/metalink
    Regards,
    OTN

  • Multiple Selections in List Box

    Hello all. I am new to the Adobe Family and especially PDF designing, so please bear with me. I have gone through the Help section, and did searches on here to find an answer but have not had luck. I need to make a list box that the user chooses multiple choices. As in some forms that have if you hold down the CTRL button you can choose multiple choices. During my searches I keep finding coding lines. I'm not sure how to do coding at all, I'm using the Designer 7 template forms where I can choose the icon, and then go over to Object, Value, etc. Is what I want to do even possible with Designer 7? If so, how can I make this work. If not, what program would I need to use? Thank you in advance for your help!

    When I look at either a list box or a drop-down list and look at the "Field" tab I do not see a "Allow Multiple Selection" checkbox. I am using designer version 7.0.041126.0. Is it not supported in this version or am I missing something.
    Thanks

  • Multiple Selection in List

    I am using a List filled with s:MobileIconItemRenderers and would like the ability to select multiples.  If I am using the Mouse and keyboard i can use the combination of ctrl and click to accomplish this, but that's not possible on the phone.  Is there an easy way to cause this to be the default behavior?  I even tried adding a click listener and modifying the selectedItems property of the list but couldn't get that working.  Any help would be greatly appreciated.
    Thanks

    I added the following function to the iconrenders click event.  (I am storing the status in a vector
    protected function mobileiconitemrenderer1_clickHandler(event:MouseEvent):void
         if (outerDocument.selection.indexOf(event.currentTarget.data) == -1)
                   outerDocument.selection.push(event.currentTarget.data);
                   event.currentTarget.selected = true;
              else
                   outerDocument.selection.splice(outerDocument.selection.indexOf(event.currentTarget.data),1 );
                   event.currentTarget.selected = false;
    and I also added the following to the changing event on the list
    protected function lList_changeHandler(event:IndexChangeEvent):void
         event.preventDefault();

  • Multiple selections for List on Mac

    It seems multiple selections for java.awt.List on Mac OS X is not working, or do I need to use special buttons to select?
    Thanks in advance.

    Hi,
    I'm experiencing the same issue on our CUCM 9.1.2.10000-28 & CUP&IM 9.1.1.30000-3: I have a Jabber for Windows client v9.7 that should only show 1 hardware phone, but it shows 2 entries. I checked the above and still we have 2 entries (also after clearing the Jabber cache). Also I tried another Jabber for Windows version (v9.6), but it always pulls 2 hardware phones in it's config.
    Have you managed to get this solved? We use Cisco 8945 phones where end users log on via Extension Mobility. I noticed in Dependancy Records that we have an entrie in Extension Mobility Dyncamic, which shouldn't be the case because no end user is logged on, but it shows it in Dependancy Records... A bug?? And when the end user logs on an IP Phone, then we have twice Extension Mobility Dynamic entries... Not good since only 1 device is in use via Extension Mobility (multiple logins are disabled via parameter).
    Greets,
    David
    Greets,
    David

  • How to update multiple records in custom table using checkbox in APEX 4.1?

    Hi,
    I have a SQL report which brings up all the data records using the following query.
    select
    "REC_NO" AS hidden_rec_no,
    "REC_NO",
    APEX_ITEM.CHECKBOX (3,rec_no) AS edit,
    "MEETING_TYPE",
    "PAGE_NO",
    "CHECKBOX"
    from "XX_TEST" m
    WHERE page_no = :p_page_no
    Out of all records, any records which are checked, I only want to update their flag to 'Y' on the database column "Checkbox". For this, I have a SUBMIT button on the report region. The processing code on pressing the SUBMIT button is:
    DECLARE.
    l_row NUMBER := 1;
    BEGIN
    FOR i IN 1..APEX_APPLICATION.G_F03.COUNT
    LOOP
    FOR j IN l_row..APEX_APPLICATION.G_F01.COUNT
    LOOP
    IF APEX_APPLICATION.G_F01(j) = APEX_APPLICATION.G_F03(i) THEN
    UPDATE xx_test
    SET checkbox = 'Y', -- APEX_APPLICATION.G_F03(j)
    WHERE rec_no = APEX_APPLICATION.G_F03(i);
    l_row := j + 1;
    EXIT;
    END IF;
    END LOOP;
    END LOOP;
    COMMIT;
    END;
    However, that is not happening. Please help me with this. Any solutions/suggestions are most welcome.
    Regards.

    Hi,
    Try
    BEGIN
      FOR i IN 1..APEX_APPLICATION.G_F03.COUNT LOOP
        UPDATE xx_test
        SET checkbox = 'Y'
        WHERE rec_no = APEX_APPLICATION.G_F03(i);
      END LOOP;
    END;Code loops all checked checkbox. You do not need commit on page process.
    Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0

  • Query about multiple selection of List item in forms 6

    How can I select multiple elements from a list item in Forms 6?

    the very simple strategy to do is to call removeAllItems() method for the 2nd combox box and then insert the contents. this is because the validate() method is not repeatedly called and so the contents are not updated immediately.

  • Hotmail style - select rows in table  (using checkboxes)

    Hi!
    I have a table that is bound to a CachedRowSet.
    Each row in the table has a checkbox. You check each of the row you want to delete, and the click a "delete" button bellow the the table. And the checked rows will be deleted!
    If it is possible, it should also work with paging.
    How do I implement this?
    I still find it hard to understand the JSF way of handling submits, I am use to the old request/response way of do this.
    Regards, Niels Peter

    Hi Niels,
    It is not clear if you are using Sun Java Studio Creator to build your webapplication using JSF. If you are then a sample application called AppModel demonstrates exactly what you are looking for. This is available at:
    http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    In case you are not using Creator then you would have to post your query in the appropriate forum as this forum is exclusively for discussions related to Creator.
    Going through the AppModel sample application might still give you an idea if you can download the IDE and run this application.
    Hope this helps
    Cheers
    Giri

  • Managing multiple selections using listModel......

    Hey,
    Im a newbie to java can anyone give me a pointer or two as to how I would go about removing multiple selections from a JList using listModel??
    Any help would be great.
    -Ben

    Why not try using the removeSelectionInterval(int,int) method of the JList itself? It should be fairly obvious as to how to proceed with this (i.e. stepping through the list element at a time, deselecting as necessary).
    I'm watching this topic if you need further help!

  • Multiple selection in interactive reports

    hi,
    how can we do multiple selection in interactive reports using check box?
    my first list will have a list of account numbers along with the check box. if few check boxes are clicked then the other fields from the table for the checked account numbers . kindly help me with this.

    Hi,
    REPORT zbcd .
    data : BEGIN OF ITAB OCCURS 0,
            VAR1(4) TYPE C,
            VAR2(4) TYPE c,
           END OF ITAB,
           LINE1 TYPE I,
           VAR3(4) TYPE C,
           VAR4(4) TYPE C,
           FLAG TYPE C,
           CURRENT TYPE I.
    data : BEGIN OF WA OCCURS 0,
           XYZ(100) TYPE C,
           END OF WA.
    MOVE: '1234' TO ITAB-VAR1,
          'ABCD' TO ITAB-VAR2.
    APPEND ITAB.
    MOVE: '5678' TO ITAB-VAR1,
          'EFGH' TO ITAB-VAR2.
    APPEND ITAB.
    MOVE: '9999' TO ITAB-VAR1,
          'IJKL' TO ITAB-VAR2.
    APPEND ITAB.
    SET PF-STATUS 'BUTTONS'.
    *HERE PF-STATUS CONSIST OF PUSHBUTTON WITH USERCOMNAD 'DISP'.
    LOOP AT ITAB.
    WRITE: / FLAG AS CHECKBOX, ITAB-VAR1, ITAB-VAR2.
    ENDLOOP.
    DESCRIBE TABLE ITAB LINES LINE1.
    REFRESH ITAB.
    CLEAR ITAB.
    CURRENT = 0.
    CLEAR: VAR3, VAR4.
    AT USER-COMMAND.
    CASE SY-UCOMM.
    WHEN 'DISP'.
    DO LINE1 TIMES.
    CURRENT = SY-INDEX + 2.
    READ LINE CURRENT LINE VALUE INTO wa.
    IF wa-XYZ(1) EQ 'X'.
      WRITE: wa-XYZ+2(4) TO VAR3,
             wa-XYZ+7(4) TO VAR4.
      WRITE: VAR3 TO ITAB-VAR1,
             VAR4 TO ITAB-VAR2.
      APPEND ITAB.
    ENDIF.
    ENDDO.
    ENDCASE.
    THEN U SECONDARY LIST VALUE SELECTION TAKES PLACE
    SELECT * FROM MARA INTO TABLE ITMARA FOR ALL ENTRIES IN ITAB WHERE MATNR = ITAB-MATNR.
    LOOP AT ITMARA.
    WRITE:-----FIELDS TO BE DISPLAY IN OTHER LIST...
    ENDLOOP.
    *NOTE :-1.PLEASE EXECUTE ABOVE PROGRAM WITH OUT CHANGES IN DEBUG MODE TO CLEARLY UNDERSTAND. 
    2.ALSO U CAN MOVE ABOVE ITAB REQUIRED FIELD VALUES INTO ONE OF INTERNAL TABLE(BY LOOPING) WHICH IS LIKE SELECTOPTIONS MARA-MATNR(ie TB_MATNR) AND USE*
    (AND INSTEAD OF VAR1 AND VAR3 U CAN PLACE THE MATNR)
    SELECT * FROM MARA INTO TABLE ITMARA WHERE MATNR IN TB_MATNR.*
    Edited by: Vijay Mekala on Feb 1, 2008 5:16 PM

  • Embed Font in a List Control

    I have no problem embeding fonts to be used in dynamic text
    but I cannot get my style to apply to a list control using AS3.
    My style code is:
    import fl.managers.StyleManager;
    var menuStyle:TextFormat = new TextFormat();
    menuStyle.color = 0xFFFFFF;
    menuStyle.size = 20;
    menuStyle.font = new CKTerzini().fontName;
    menuStyle.letterSpacing = 1;
    menuStyle.align = "center";
    StyleManager.setComponentStyle(List, "textFormat",
    menuStyle);
    My list control code is:
    my_list.setStyle("embedFonts", true);
    //my_list.setStyle("textFormat", menuStyle); DOES NOT WORK
    my_list.setRendererStyle("textFormat", menuStyle);
    I also have the font added to the library and properly
    linked. (Class name set to CKTerzini).
    This code works fine with the font on the system but not on a
    computer without the font.
    I have tested that the font is embed in the SWF by using the
    style on dynamic text and it works fine.
    Any suggestions would be greatly welcomed...
    Robert Pritchard
    Nerds Software

    Can you post the code for your list, renderer and custom control?

  • Multiple selection ranges reversed when I append on storyline

    When I append multiple selection ranges in a clip to the storyline, the order is reversed on the storyline.  I've found others with similar issues and no solution aside from deleting FCP preferences in the library and/or reinstalling, both of which i've done to no avail.  It is excruciating and doesn't seem to make much sense as to why a shortcut would have been created only to force me to rearrange the clips on the storyline and waste the time that's supposed to be saved. I've also tried it on another computer, and the same issue.  Supposedly the clips are arranged in the order of the selections but they are always placed in the reverse order in which I select them.  I am trying my best to become accusomted to FCPX after switching to Premiere CS6 by default upon FCPX's release but so far seems to be a waste of a purchase.... 
    Anthony

    Thank you for your response and attempt to reproduce this issue, i've since pinpointed that I only have the issue when I attempt to append multiple selections I have made in list view in the event browser.  Whenever I append these multiple selections in list view, they will always be in the reverse order that my selections were made, but discovered these workarounds:
    1) after making the multiple selections in list view, switch views to filmstrip view and then append
    2) once the selections are made in list view, press F to rate them, and then select the subclips and append them to the storyline
    That is the only way I can get them to appear in the order I intended.  I have found users to be polarized on this issue, having found only a few editors on other forums with this issue and finding most who seem like my issue is a freak occurance (even got the great Larry Jordan to respond on his forum and not being able to replicate the issue).  So i'm hoping an upgrade will fix the problem in the near future.  I've tried deleting preference files however did not uninstall and reinstall on one of my machines since I already tried doing so on another machine to no avail...
    Thanks anyways for the response!
    Ant

  • Multiple Selection Restricted to 5000 : How to increase it ?

    Dear experts ,
    When i make a multiple selection for list inputs , the system restrics the input to 5000. How can i increase the no. of hits ?
    Pls help ....
    Regards

    from OSS note 421576:
    Database selections can only process a limited number of input variables which is dependent on the database. The number of values which can be processed at a maximum differs according to database. For a MS-SQL server, this number is approx. 1000.
    Solution
    Limit the number of selection values correspondingly.

  • Active mode multiple selection in dialog screen

    in my dialog screen i had multiple selection option button by using the below function module.
    CALL FUNCTION 'K_CMPERS_MULTIPLE_SELECTION'
      EXPORTING
        P_FIELDTYPE         = 'R'
        P_FIELDNAME         = 'MATNR'
        P_TABLENAME         = 'MARA'
      TABLES
        PT_PARM             = HMAT.
    its working fine.
    but when i enter data into multiple selection it does not changes to active mode ( green color).
    can u pls tell me how to change it into active mode when data is there

    Hi Banu,
    The icon will not change automatically. You need to write code in PBO and change the icon of your push button accordingly.
    Please refer to the document below for how to change icon of push button in module pool:
    [http://wiki.sdn.sap.com/wiki/display/sandbox/ChangeanIconofaButtonDynamicallyInModulePool|http://wiki.sdn.sap.com/wiki/display/sandbox/ChangeanIconofaButtonDynamicallyInModulePool]
    Cheers,

Maybe you are looking for