Skip to Content
author's profile photo Former Member
Former Member

How to get the Row that is Deselected.

Hi,

i need help,

i have created a table with sap.ui.table API.

i am using "rowSelectionChange" event to trigger when ever the user selects the row in the table. and i will push the selected row data on to array. by getting its index using "oTable.getSelectedIndices".

but if i deselect the row. that same event return -1 to the even handler.

so please some one, suggest me the any event handler or any way to get the deselected

row index......

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Feb 13, 2018 at 02:14 PM

    https://ui5.sap.com/#/api/sap.ui.table.Table/events/rowSelectionChange

    rowIndex int

    row index which has been clicked so that the selection has been changed (either selected or deselected)

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 13, 2018 at 11:32 AM

    Hello ,

    Can you use sap.m.Table instead

    <Table id="idProductsTable"
    inset="false"
    items="{path:'dataset>/EmployeeSet'}"
    itemPress="onClick"
    >
    You can get the elements in controller using the below code
     onClick: function(evt){
    var oSelectedItem = evt.getParameter("listItem");
    var cells = oSelectedItem.getCells();
    var Name = cells[0].getText();
    var Emp = cells[1].getText();
    }
    
    In this you will not face any issues like deselect, let us know if you want to use sap.ui.table only.
    
    
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.