Retrieving value of selected item in sap.m.list

var data = {
                details :   [{             
             Name : "MuthuKannan",  Age : "22",Location :"Bangalore" },
          {  Name : "Sachin Tendulkar",  Age : "35", Location :"Mumbai"  },
var model = new sap.ui.model.json.JSONModel();
model.setData(data);
var model1 = new sap.ui.model.json.JSONModel(); 
model1.setData({ 
         col1 : "Name ", 
         col2 : "Age", 
         col3  : "Location "
sap.ui.getCore().setModel(model1, "mkModel1");
list = new sap.m.List("", { 
              threshold: 2,
              inset : false, 
              select :  function(){
         a = list.getSelectedItems();
             alert(a[0].getBindingContext());
How can I get the name of selected item? I tried the highlighted text but I am unable to proceed ,I even tried toString() function still I am not getting the output.All I am getting(alert box)  is either "null" or "undefined". Kindly help me on this.
Thanks and Regards,
Muthu Kannan S

Try this
list = new sap.m.List("", {
              threshold: 2,
              inset : false,
              select :  function(oEvent){
                 // oEvent is the key to access everything
                 oEvent.getSource().getSelectedItem() ;

Similar Messages

  • Previous Values of Selected Items in a Datagrid

    I have a datagrid which the dataprovider is bound to an ArrayCollection of Value Objects from a web service.
    One other thing which is important to point out.   The Value Objects are created automatically for the Data/Service and so if I change the files, they will just be overwritten the next time I make a change to the service.
    The grid displays Inventory Items.    Lets say that Item 1 has a qty of 20.   Item 5 has a Qty of 10.
    The list in this grid is based upon the selection of a Location tree.   So it lists the inventory items for a certain location.
    I also have a second tree and grid for the to location inventory items.
    Between the two grids, there is a button which when clicked it iterates thru the selected items and creates a new item in the to list with qty 1 and saves it.  then decreases the current qty in the from list by one.
    So lets say I selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 1 and then saved.   Then the qty in the from list is decreased by 1 and saved and so the vales for 1 is now 19 and for 5 is 9.
    I would like to be able to change the qty in the from list to the qty I want to move.   So when the button is clicked the new item in the to list reflects the new qty and is saved.   Then the previous value of the current qty is decreased by the qty which is displayed in the grid
    So lets say I changed item 1 to 2 and Item 5 to 3 and then selected items 1 and 5 and then clicked the button.   A new copy of Items 1 and 5 are created in the to list with a qty of 2 for item 1 and 3 for item 5 and then saved.   Then the qty in the from list is decreased for Item 1 by 2 and item 5 by 3 and so now Item 1s qty is now 18 and items 5 qty is now 7.
    My first thought was if I had the previous values stored then no big deal.  But I put a break point at the point where the SelectedItems list is being iterated through and the previous values are not stored anywhere. 
    Any suggestions for this?

    ...in the mean time, this 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 you have this property
    multiselect:true
    in that case, selection returns an array,
    this.selection[0].index;
    would give you the first selected item, even if you only have one item selected, to get all selected items loop thru all items in the selection array.
    not sure if Peter's wonderful guide explains this (it is explained in the Tools Guide), but you should read it too, it has tons of great info.

  • Using value of selected item list

    I'm working on existing code. I want to use the value of a selected item in a list to use it in a query. So, the corresponding records should be displayed in a subform when an item of the list is selected. This is the code i'm using:
    This is the code i use to populate the list
    DECLARE
    locatienaam varchar(100);
    locid number;
    recordcount number;
    i number;
    correct NUMBER;
    hList ITEM := Find_Item('LIST_LOCATIE');
    iRC PLS_INTEGER := 0;
    currValue VARCHAR2(60); /* increase if required*/
    BEGIN
    --vraag het bijhorende ID op van de geselecteerde locatie.
    currValue := Name_In('LIST_LOCATIE');
    FOR i IN 1..Get_List_Element_Count(hList) LOOP
    IF currValue = Get_List_Element_Value(hList,i) THEN
    iRC := i;
    break;
    END IF;
    END LOOP;
    locid := GET_LIST_ELEMENT_VALUE('LIST_LOCATIE', iRC);
    locatienaam := GET_LIST_ELEMENT_LABEL('LIST_LOCATIE', iRC);
    Below the code i use to make the query
    SET_BLOCK_PROPERTY('V_KALENDER',DEFAULT_WHERE,'(BEGINDATUM BETWEEN '||''''||:V_KALENDER.TIJDSTIP1 ||'''AND '||''''||:V_KALENDER.TIJDSTIP2||''') AND (NAAM=:locatienaam)');
    GO_BLOCK('V_KALENDER');
    Execute_Query;
    I get the message: "unable to resolve reference to locatienaam"
    The subform is populated with all the records between the two dates of all the locations, not only by the selected location.

    Hi,
    Welcome to the forum!
    If locatienaam is a local variable, don't use a colon (:) to reference it.
    You didn't say
    IF :currValue = Get_List_Element_Value(:hList,:i) THEN so why should you say
    :locatienaam?

  • Check Value of Selected Item

    I select an item from table, what syntax do i have to use to know if the last digit of the value i selected is equal to 6 to 9?and how can i append value from that selected item

    Hi,
    u can use like this....
    SELECT *
                 FROM <dbtab>
                 INTO TABLE itab
                 WHERE <fldname> LIKE '%6'
                 OR <fldname> LIKE '%7'
                 OR <fldname> LIKE '%8'
                 OR <fldname> LIKE '%9'
    and for the Appending part..
    SELECT *
                 FROM <dbtab>
                 APPENDING TABLE itab
                 WHERE <fldname> LIKE '%6'
                 OR <fldname> LIKE '%7'
                 OR <fldname> LIKE '%8'
                 OR <fldname> LIKE '%9'
    Edited by: Sukriti Saha on Oct 24, 2008 9:25 AM

  • How to get value of selected part in sap.viz.ui5.pie chart

    Hi,
       I have designed a basic Pie Chart. But i am looking for the code to get the value of the selected part of the Pie Chart,so that i can report a details based on it.
    Is their is any sample code snippets available for all event handlers of sap.viz.ui5 charts..
    Thanks,
    Prakash

    Hi Prakash,
    Refer this thread How to get the value of Selected Dimension in a Pie Chart ?
    I shared example code in this thread and I hope it will solve your question.
    also you can see example at this link https://sapui5.netweaver.ondemand.com/sdk/test-resources/sap/viz/demokit/VIZCharts.html?sap-ui-debug=true&sap-ui-language=en-US&sap-ui-theme=sap_bluecrystal&sap-ui-accessibility=true&sap-ui-jqueryversion=1.7.1
    see the eventing section and source code to know all event handles.
    Regards,
    Chandra

  • How to get the display value of selected item in list box?

    I have a page with an HtmlSelectOneListbox that is filled with an ArrayList of SelectItem objects.
    The SelectItem objects contain a Key and Value. The Value is displayed in the ListBox.
    The value parameter of the listbox is bound to a bean property which is called selectedListItem.
    The bean property selectedListItem contains the Key of the SelectItem that is selected.
    How do I obtain the Value of the selectedListItem?
    I need to be able to get the Value field that is displayed, not just the Key to the item that is displayed.
    Edited by: burferd on Nov 3, 2007 10:03 PM

    How are you filling in the value of the menu? Obtain it back by the same way. Or pass it along the key in a object.
    This article may give useful insights: http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html

  • How to acquire display value of selected item on select list? Or...

    I have a select list generated from a SQL query that I need to get the display value from.
    Ideally, the display value and the submitted value of the select list would have been the same, but I can't seem to get APEX to allow populating a select list's display value and submitted value fields with the same database column.
    If you have any idea how to do either of the above, I'd love to hear from you here!
    Cheers,
    Ben

    you forgot the extra quotes I guess:
    declare
    l_sql VARCHAR2(4000);
    begin
    l_sql := 'SELECT product_name,project_name,information_access_system,dataset_name FROM v_dms_product WHERE product_name = ''' || :P24_CHOOSEPRODUCT || ''' GROUP BY product_name,project_name,information_access_system,dataset_name';
    return l_sql;
    end;

  • Using selected items from drop-down list in rest of page

    Hi,
    I hope I'm able to describe clearly what's the problem.
    So I'm implementing a form for the moment. It contains a drop-down list. The user has to select one item from it and as a result another drop-down list on the same page needs to be filled with a couple of options. I wanna do this without refreshing the page, cos else I have to retrieve all the values from boxes that were allready filled in. Is it possible?
    Greetings,
    Raf

    This cn be done with javascript. But you need to cache the data on first load of your jsp.
    regards

  • Based on select list, i need to retrieve values in other select list

    Hi,
    am new to apex using apex3.2, i need to retrieve values in select list based on the other select list vale with out refreshing page.
    ie i have region select list and country select list,in country corresponding region country must be display but with out refreshing page.
    can you please any body guide me.
    Regards
    shashidhar
    Edited by: 871140 on Jul 7, 2011 10:34 PM

    Hi,
    you can use cascading LOV for that, i which the other LOV field will be changing depending upon the selection of other value(which is in LOV).
    http://www.inside-oracle-apex.com/oracle-apex-4-0-cascading-lovsselect-lists/
    Regards,
    Mini
    Mark Answers Promptly

  • How to Captured Value into Select-Options Range Table Without "Enter"

    Hi,
    I defined a set of Select-Options in the Web Dynpro. I found that the value for the Select-Options will not be captured whenever I manually type in the value instead of choosing it from F4 Help Drop Down.
    However, this problem can be resolved if I manually type in the value for Select-Options in the Selection Field and I press "Enter". Without pressing "Enter" value will not be captured.
    Any solution for this issue? Please help.

    Hi Kris,
    My problem is only when the user key in the value themselves rather than choosing it from Select-Options drop down value. Most of the time user will know what value to key in and will skip the step to choose from the Drop Down List. Thus, if this happen, the value keyed in by the user will not be able to capture into the range table.
    I am using this logic to capture the value for selection item:
      wd_this->m_helper->get_selection_screen_items(
        IMPORTING et_selection_screen_items = lt_sel_item ).
    * Values From Selection Screen
      LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.
        CASE <fs_sel_item>-m_id.
          WHEN `PERNR`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_pernr>.
          WHEN `BUKRS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_bukrs>.
          WHEN `STAT2`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_stat2>.
          WHEN `WERKS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_werks>.
          WHEN `BTRTL`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_btrtl>.
          WHEN `PERSG`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_persg>.
          WHEN `PERSK`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_persk>.
          WHEN `ABKRS`.
            ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_abkrs>.
          WHEN `BEGDA`.
            ASSIGN <fs_sel_item>-m_value->* TO <fs_begda>.
        ENDCASE.
      ENDLOOP.
    E.g. User key in the BUKRS without using the Drop Down Value provided by the Select-Options. For this case, <fs_bukrs> table will be initial as no value is captured.
    Edited by: Girish Nabar on Apr 21, 2011 8:55 AM

  • Display selected items in dynamic list box

    I need to display the selected items in a dynamic list box -
    this worked great - but now client wants multiple selected. I do
    have the items comma delimited in single field (but I can change
    that if I need to) - so how do I make those items display as
    selected in list. I'm using asp and standard dreamweaver list based
    on a recordset.

    There is a better approach. I faced a similar problem and put all the logic in a Javascript function. I modified my code to suit your needs.
    My HTML will have the following.
    <body onLoad="javascript:initLanguages();">
      <form name="languageForm">
        <select size="1" name="languagesList">
        </select>
      </form>
    </body>I created a Javascript function
    <script language="Javascript">
      //-- put all your languages here in a Javascript Array if they are fixed.
      //-- If you get the langauges from a Java object (dynamic or configurable), generate the Javascript in that object and insert a scriptlet in the HTML that plugs in the generated Javascript into this HTML. If so, take care of the quotes and double quotes. They are tricky !!!
      var languageArray = new Array("Fran?ais", "English", "Espanol", "Deutsch", "Italiano");
      function initLanguages ()
        var listCounter = 0;
        for (var ind=0; languageArray != null && ind < languageArray.length; ++ind)
          var obj = eval("new Option" + languageArray[ind]);
          eval("document.languagesForm.languagesList.options[listCounter]=" + "new Option" + languageArray[ind]);
          if(document.languagesForm.languagesList.options[listCounter].value == "<%= selectedLanguage %>")
            document.languagesForm.languagesList.options[listCounter].selected = true;
          listCounter += 1;
    </script>
    selectedLanguage is something you get in the Java code
    <%
      selectedLanguage = myObj.getSelectedLanguage();
    %>

  • How to get the selected items from listbox

    Regarding listbox i have two questions
    1) I want to get the selected items as per the order in which ihave selected.Presently i'm getting in the ascending order.For example after selcting the 1,2,6 if i select 3 then its giving 1,2,3,6.But i want it in the order 1,2,6,3
    2)I want to select items from a single list box to many other listboxes.(ie) my first selection should goto first,second one to the second listbox and like this.How should i write the logic.
    please give me a suggestion.

    In order to have the selected items line up in accordance to the selection order, please do it one at a time. (That's the limit for that VI)
    If you need more than that (i.e. to regconize which item clicked first and which one comes later), you may have to figure it out ya
    Wish you good luck. Perhaps, someone else has a already made vi.
    Cheers!
    ian.f
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com

  • List and selecting items in it ?

    I use List (element in building GUI). In emulators it works nicely and I have possibility to select one item from the list (I didn't code anything about selecting it) it was automatically added to menu. This is great.
    When running the same app in actual device (Nokia 7210), the "select" is not possible / provided by the phone...Theere is no such element at all. So I actually can't select an item out of list.
    In nokia 7650 this doesn�t occur.
    My mistake, need to program ? .. how to proceed ?
    P

    Funny that mine doesn't work and I have the same firmware version...
    My situation is that I have a List, with items that are ment to be selected.. I need to have commands generally concerning the whole application and commands that are available after user have selected one item from the list.
    This is now done so that I have one List (holding those selectable items...), select button then leads to another list, where I have list of actions available to selected item.
    The previous list also has Commands appended to it.
    These commands are always available, but in phone the List Select button is gone, and accesing that other list (with detailed actions concerning only the selected item) is then impossible.

  • RE: Viewable Items on a Drop List in Forte V2

    Hi Kumar,
    Let me guess, you're using windows NT 4.0 as your client.
    I had the same problem a few months ago and raised the
    question in this list.
    My answer is as brief as it is unsatisfying:
    It is a known bug for which there is no work around.
    Forte 2 and NT 4.0 don't mix very well. Forte 3 works fine.
    You think you found some logic behind the bug, but you
    haven't. I just so happened it works this way for these
    droplists in this window. Other droplists in other windows
    will not follow this logic. Some won't even show the bug.
    These are your choises:
    Don't use NT 4.0
    Switch to Forte 3
    Don't use droplists
    Use some tricks, like adding an empty row at the end
    of the list.
    Pascal Rottier
    STP - MSS Support & Coordination Group
    Philip Morris Europe
    e-mail: [email protected]
    Phone: +49 (0)89-72472530
    +++++++++++++++++++++++++++++++++++
    Origin IT-services
    Desktop Business Solutions Rotterdam
    e-mail: [email protected]
    Phone: +31 (0)10-2428100
    +++++++++++++++++++++++++++++++++++
    /* My reality check bounced */
    -----Original Message-----
    From: Kumar Krishnasami [SMTP:[email protected]]
    Sent: Friday, March 05, 1999 5:30 PM
    To: [email protected]
    Cc: Kumar Krishnasami
    Subject: Viewable Items on a Drop List in Forte V2
    I have a set of drop lists that are part of an array field which are
    populated dynamically. If I set the number of viewable items to n,
    and
    if the drop list has m number of items in it, the number of items
    that
    actually appear is n-1 if the list contains more than n items( m>n)
    and it is m-1 if the list contains less than n items (m<n).
    For example, if I set the number of viewable items to 4 and a drop
    list contains 7 items, the actual number of viewable items I see is 3
    (4-1) whereas if the drop list contains 2 items, the actual number of
    viewable items I see is 1 (2-1).
    I searched through the archive of this list and found that this same
    issue was raised before, but couldn't find any replies pertaining to
    it.
    Is this a "feature" of Forte V2? I tried the same thing with Forte V3
    and it does work fine in V3.
    Any pointers would be appreciated.
    -- Kumar Krishnasami.
    p.s:- It doesn't matter how I set the viewable items. I tried both
    setting them through the windows workshop as well as in the code
    after
    the self.Open() in the Display() method. The behavior is the same in
    both cases.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    On Wed, 28 Jan 1998 11:50:42 +0000, [email protected] wrote:
    I have noticed that Drop List widgets show an initial value equal to
    the first value in their Element List. However, this does not seem
    to happen as soon as the Drop List is placed inside a grid with a
    mapped type. In this case, the drop list shows a blank value
    initially. Once a value is selected from the drop down list, it
    always has a value.I have found the following behaviour to be true of DropLists with an
    object mapped type (ie, TextData as opposed to string): If you
    instantiate the mapped attribute in the Init() method (ie,
    self.theDroplist = new()), then the DropList will display the first
    item in the list as selected when the window comes up. If however, you
    do NOT instantiate the mapped attribute, then you get the behaviour you
    are observing where the DropList defaults to showing nothing until the
    user makes a selection. It's kind of an odd behaviour, but you can
    take advantage of it in cases where you want to force something to be
    selected by the user, but you don't want an initial default.
    Dale
    ================================================
    Dale V. Georg
    Systems Analyst
    Indus Consultancy Services
    [email protected]
    ================================================

  • How to retrieve selected item details (Product Id, Quantity) in Action clas

    Hi
    I want to retrieve the selected item details (Product Id, Quantity) in my custom action class .I am calling custom action event after u2018add to cartu2019 button clicked.  I basically need these details to pass to custom BAPI. I can able to retrieve User Name and itemkey successfully.  I Tried to retrieve the product , productID using WebCatItem but I was getting run time error and when I debug the code I can see webCatItem coming  as null. Below is my code. 
    public class Z_AddToBasketAction extends BaseAction {
         /* (non-Javadoc)
    @see com.sap.isa.core.BaseAction#doPerform(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         public ActionForward doPerform(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException {
              //Cache.Access access = null;
              Map returnValues = null;
              UserSessionData userSessionData =
                   UserSessionData.getUserSessionData(request.getSession());
                   BusinessObjectManager bom =
                             (BusinessObjectManager) userSessionData.
                             getBOM(BusinessObjectManager.ISACORE_BOM);
         String selectedPartnerID = bom.getUser().getUserId();
         String strItemkey=request.getParameter("itemkey");
         WebCatItem webCatItem =     (WebCatItem) request.getAttribute(
                             com.sap.isa.catalog.actions.ActionConstants.RA_WEBCATITEM);
         //If you are looking at Product attributes.
          String att =  webCatItem.getProduct()", "webCatItem.getProductID();
         ZBOM mybom = (ZBOM) userSessionData.getBOM(ZBOM.ZCUSTOM_BOM);
         return mapping.findForward("success");
    Please help
    Thanks
    Aravind
    Edited by: Aravinda Boyapati on Nov 30, 2010 10:21 PM

    Hi Arvinda,
    From which page you are trying to add products in cart? Are you selecting only 1 item at a time and then click on Add to cart button or you select more then 1 items to add into cart.
    You can ceate hidden input filed and set their value through java script when you select any item. If more then 1 items then you can create an arry and set in the request parameter and then retrieve it in your custome class.
    Regards.
    eCommerce Developer.

Maybe you are looking for

  • Bluetooth Mighty Mouse & Windows XP using Bootcamp

    Are there plans to add functionality for the bluetooth mighty mouse in Windows XP using bootcamp?? Macbook Pro   Mac OS X (10.4.7)   I run Bootcamp, as well as OS X

  • Cross Docking Pick TO cancellation

    Hi Experts I am trying to Configure the Cross docking scenario I have configured the following 1. Cross-dock Warehouse level customization in SPRO-LE-WM-Cross Docking-Maintain Warehouse level Settings 2. Cross dock relevancy for movement types in SPR

  • How to complain about bad web site

    A web site came up when searching for another website. The website pretended to have the name of the site I was looking for. When I selected the false link I was taken to www.mawords.com which showed a header that implied it was the site I was lookin

  • Install keeps failing on MBP 2.16

    I have tried multiple times to do the install (5 to be exact). Each time it fails at a different point. Of course it gives no reason. I have tried it as an update from 10.5.8 and also from a blank hd. Please any suggestions that can help would be app

  • I cant register in itunes "your payment methode declimed"

    what i must to do to register in itunes ? im sure that my debit card is ok i dont have credite one. Its from US im in US and fill all the information and nothing pls help me