cancel
Showing results for 
Search instead for 
Did you mean: 

How to count selected rows with checkbox in sap.m.table

Former Member
0 Kudos

Hi,

Is there any property or method which gathers the information about number of selected rows with checkbox in sap.m.table.Please share recommendtaions/alternatives.

Regards,

Koti Reddy

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

HI Koti

will this example help?

Example

-D

Former Member
0 Kudos

Hi,

I saw your example which is showing the selected rows context but not the number of total selected rows.

I already achieved that functionality with below code.Please let me know the property/way to get the count of total number of selected rows.

onSelectionChange1: function(oEvent){

           var oSelectedItemContext = oEvent.getParameter("listItem").getBindingContext();

           var selectedItems = sap.ui.getCore().byId("viewid").byId("tbl").getSelectedItems();

}

If I select only one row , it should display 1. If I select 3 rows,it should display as 3.

Regards,

Koti Reddy

maximilian_lenkeit
Participant
0 Kudos

The method getSelectedItems returns an array, so all you need to do is to access the length property: oTable.getSelectedItems().length

- Max

Former Member
0 Kudos

Thank you for hint..Earlier typo in my code caused the issue..Your hint helped me to solve the issue.

Regards,

Koti Reddy

Answers (0)