Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 13 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 comment
    10|10000 characters needed characters exceeded

  • Feb 13 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 comment
    10|10000 characters needed characters exceeded