¿How can I to get the selected index from a table in sapui5?

I have a multiselect table for each item I need to open a Dialog and bind then the table.
How Can I to obtain the index position from my table?
var myTable = sap.ui.getCore().byId(this.sId);
var myItem = sap.ui.getCore().byId(myTable.getSelectedItem());
Thanks in advance.

Hi,
You can also use getSelectedContexts of table instance to get the selected indices of sap.m.Table
var aContexts = myTable.getSelectedContexts(true);
for(var i = 0 ; i < aContexts.length ; i++)
var selectedIndex = parseInt(aContexts[i].sPath .split("/")[2]);
Thanks,
Rumeshbabu S

Similar Messages

  • Getting the selected index of a table (CL_WD_TABLE) without lead-selection

    Hi
    When I click in a table-UI (not alv-table) on a f4-help, I can search with se11-searchhelp on a field. After I choose something, I should also fill some other fields in the same row.
    In the table I have no lead-selection. So, I am searching for a method that gets me the selected index. The element-class for the table-UI is CL_WD_TABLE.
    Once I have the selected index, I could change the fields in the same row inside the WDDOMODIFYVIEW.
    With activated node-selection it can be, that the user selects one row, but he starts the f4-help on another row (the lead-selection doesn't change).
    I have seen this article, but i hope that for the table-UI it is different than with alv:
    [ON_CELL_ACTION triggered only by ENTER ?]

    Hi Lorenzo,
    I'm trying to do the same thing and came up with this solution. In WDDOMODIFYVIEW, since we cannot know in which table row the user clicked the search help, I simply loop through all the rows of the table. For each row, I delegate to a method in the Component Controller which sets the specified index as the table's lead selection then reads the selected table row from the context. I can then populate fields in the selected row as needed.
    METHOD wddomodifyview .
       DATA lo_componentcontroller TYPE REF TO ig_componentcontroller.
       DATA lo_nd_items TYPE REF TO if_wd_context_node.
       DATA lt_items TYPE wd_this->elements_items.
    * -- Upon return from the search help, populate table row details
       lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
       lo_nd_items = wd_context->get_child_node( name = wd_this->wdctx_items ).
       lo_nd_items->get_static_attributes_table( IMPORTING table = lt_items ).
    * Since we cannot know in which table row the user requested the search help,
    * loop through all table rows, populating table row details as needed.
       DESCRIBE TABLE lt_items LINES sy-tfill.
       DO sy-tfill TIMES.
    *   Delegate to the Component Controller
         lo_componentcontroller->get_table_row_detail( sy-index ).
       ENDDO.
    ENDMETHOD.

  • How do i get the selected index in jsp from a select "in the same page!!!"

    i dont if it si possible but i want to get the selected index form a select implmenting javascript jsp an html something like this:
    html:select property="slcLocation" onchange="updateList(this.form)">
    <% for (int i=0; i< user.getNumLocaliza();i++)
    out.println("<option selected>" + user.getLocation(i,1));
    %>
    </html:select> </div></td>
    ...

    i try it in the same page but it fails, the code is:
    <html:select property="slcLocation" onchange="document.location.href='cajaApertura.jsp?slcLocation='+this.options[this.selectedIndex].value">
    <%
    for (int i=0; i< user.getNumLocaliza();i++)
    out.println("<option>" + user.getLocation(i,1));
    %>
    </html:select>
    </div></td>
    </tr>
    <tr>
    <td><div align="left"><font size="1"><strong><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif">Caja:</font></strong></font></div></td>
    <td bgcolor="#C4B4F3"><div align="center">
    <html:select property="slcCaja" onchange="document.location.href='cajaApertura.jsp?asdf='+this.options[this.selectedIndex].value">
    <%
    int caja;
    if (request.getParameter("slcLocation")!=null)
    //for (int i=0; i< cajaLocation.getNumCajas (request.getParameter("slcLocation"));i++)
    for (int i=0; i< 3;i++)
    caja = i+1;
    out.println("<option> Caja p " + caja + request.getParameter("slcLocation"));
    }else
    for (int i=0; i< cajaLocation.getNumCajas (user.getLocation(0,1));i++)
    caja = i+1;
    out.println("<option> Caja " + caja);
    %>
    </html:select>
    is this correct? what is my mistake?
    tnks for your help

  • How to get the selection parameters from logical database into one of the t

    Hi Sap ABAP Champians,
    How to get the selection parameters from logical database into one of the tab in the tabstrip selection-screen.
    Please help me for this
    Thanks
    Basu

    Hi
    Thanks, that will work, but then I'll have to insert code into all my reports.
    I can see that "Application Server Control Console" is able to rerun a report.
    This must mean that the Report Server has access to the runtime parameters.
    But how?
    Cheers
    Nils Peter

  • Getting the selected index of a UIX MessageChoise

    Hi .
    I have a UIX page with MessageChoise.
    On the same page I have a submit button with an event named getSelectedIndex.
    I let the event invoke an UIX event handler method named
    getSelectedIndex(....).
    Question: How do I get the Selected index of the MessageChoise in this method.
    Please help .Thank's
    Omar Dawod.

    If it is a bound message choice....
    I am now able to get the selected value from the message choice....
    <messageChoice model="${bindings.BuildingId1}" name="BuildingList" required="yes">
      <contents childData="${bindings.BuildingId1.displayData}">
           <option model="${uix.current}"/>
      </contents>
    </messageChoice>Then in the action....
    JUCtrlListBinding b = (JUCtrlListBinding)ctx.getBindingContainer().findCtrlBinding("BuildingId1");
    Row r = (Row)b.getValueFromList(Integer.parseInt(ctx.getHttpServletRequest().getParameter("BuildingList")));
    String selectedVal = r.getAttribute(1);Hope it helps....
    --Connie Adams                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Getting the Selected Row from a JTable

    hi,
    how Can i get the Selected row from a JTable
    thanks...

    You know that JTable class? Well, you see those methods in it called "getSelectedRow()" and "getSelectedRows()"...?

  • How can i make sure the graphic file from my subcontract create is really llegal?

    how can i make sure the graphic file from my subcontract create is really llegal?
    They have creat the PNG file which creat from Adobe Illustrator CS5.
    I have try checking on Metadata In Adobe Bridge, and it seem to be blank.
    So i would likt to know how can i make sure the graphic file from my subcontract create is really llegal?
    Thanks

    I have try checking on Metadata In Adobe Bridge, and it seem to be blank.
    So i would likt to know how can i make sure the graphic file from my subcontract create is really llegal?
    shoo: if i had to do that for every file i get  i would go insane, as scott said, post contract: files that they (sub contractor) supply you, presume them ok unless you KNOW otherwise, or a copyright flag pops up contradicting ownership.
    G

  • How can i buy again the same software from the same mac? (where it is installed and runs ok: it is for licences issues)

    How can i buy again the same software from the same mac? (where it is installed and runs ok: it is for licences issues)
    Thanks for your help.

    Hi ..
    You can redownload previously purchased apps from the App Store using the same Apple ID on all your authorized Macs for free.
    How to re download apps from the Mac App Store:
    Open the App Store. From the menu bar click Store > Sign In
    Click Purchases from the top of the App Store window.
    Select which apps you want to re download. Then right or control click where you see Installed  then click Install.
    Make sure and use the same Apple ID used for the original purchase.

  • How can i disable/hide the calling form from fnd_function.execute

    Hi,
    How can i disable/hide the calling form from fnd_function.execute.If so can any one give the syntax.
    thanks

    Hi Francesco,
    Are you talking about that ??? )) It will explain you about to get the name of the web page when you are executing an abap function for determining the values of variables...
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/how%20to%20make%20a%20variable%20even%20more%20flexible%20in%20bw-bps.pdf">How to make a variable even more flexible in BW-BPS?</a>
    This is weird: I wrote that document a few weeks ago, it is theorically published on SDN but this is not possible to find it by using the research tool... Maybe because it applies only to BPS in 3.5. I did not have enough time to migrate that solution to BI-IP 7.0.
    Regards
    Laurent

  • How can i quickly get 4,000 photos from my ipod to my iphone? "bump"? in one step, or section by section? Thanks!

    How can i quickly get 4,000 photos from my ipod to my iphone? "bump"? but can I do it in one simple step? or photo sections, by sections? Thanks!

    Were the 4,000 photos on your iPod Touch transferred from your computer via the iTunes sync/transfer process?

  • How can i display all the query items to a table?

    how can i display all the query items to a table in a jsp file?
    i always have an out of memory error..

    any body??any idea?
    is it possible thru configuration or i have to write a program by the abaper??
    Biswa

  • How can I find out the mail server from email address?

    Hi:
    How can I find out the mail server from email address?
    for example: If I know the email address is [email protected],
    how to find the pop3 and smtp mail server?
    THANK YOU

    You can't tell by the email address since you can pretty much put whatever you want in there (especially if the SMTP server is not filtering anything).
    The header may be able to tell you something. There is a Received header value which looks like it has the routing information although I am not sure if this is a complete trace or just the last hop the message took.
    Sean

  • How can I clean all the junk files from my iMac so that it can run faster?

    How can I clean all the junk files from my iMac so that it can run faster? Its been slowing down ever since I started using it.

    Before doing anything, we might be able to help with your iMac issues here.
    Please download, install and run Etrecheck.
    http://www.etresoft.com/etrecheck
    Copy/paste its report here in another reply thread so that we have a complete profile of your Mac's hardware and installed software.

  • Loaded iPhoto 9.2, my 7200 photos grew to 113,000 files with screen shots, duplicates, ,5-10copies of faces and apple has no way to eliminate this. How can I ever retrieve the original 7200 from this mess?

    Loaded iPhoto 9.2, my 7200 photos grew to 113,000 files with screen shots, duplicates, ,5-10copies of faces and apple has no way to eliminate this. How can I ever retrieve the original 7200 from this mess?

    This can happen if the HD icon is inadvertently dragged to the iPhoto Window.
    Easiest solution: restore from your back up.
    Regards
    TD

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

Maybe you are looking for