Skip to Content
0

How to get the Row that is Deselected.

Feb 13 at 10:38 AM

44

avatar image
Former Member

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......

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Jun Wu Feb 13 at 02:14 PM
1

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)

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

thank you for your response. i used the same.

0
Sagarika Gattu Feb 13 at 11:32 AM
0

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.


Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Yes, I have a clear instructions saying should use only sap.ui.table

the application is almost done but this is the last problem.

if i solve this. the application is finish.

if i get the index of deselected row. i just have to pop that from array. that's All,

please help me......

0

ok.. you can check the below link.

https://sapui5.hana.ondemand.com/#/api/sap.ui.table.Table/events/rowSelectionChange

you can use the parameter rowIndex to get the index of selected or deselected.

Regards,

Sagarika.

0

You can use the below code, to get the index of the row selected.

onselect: function(evt){

var row = evt.getParameter("rowIndices");

}

0