cancel
Showing results for 
Search instead for 
Did you mean: 

Sort items of sap.m.List

pfefferf
Active Contributor
0 Kudos

Hi,

I'm trying to sort the items of a list control (sap.m.List) like following within the controller of the view:

var oBinding = this.getView().byId("list").getBinding("items");
oBinding.sort(new sap.ui.model.Sorter("value", true, false));

The ListBinding is returned successfully, but the sort does not work.

For test reasons I bound a collection of an ODataModel. The data is retrieved from a Json file using the UI5 MockServer.

I also have implemented a filter (oBinding.filter(...) which works.

What I'm doing wrong?

Thx.

Accepted Solutions (0)

Answers (3)

Answers (3)

shrinidhi_k
Explorer
0 Kudos

This message was moderated.

Former Member
0 Kudos

Did you check if the sort() creates a request in your Network tab ? Can you also check the response you've got for the request ?

former_member220538
Active Participant
0 Kudos

Hi,

Please find below the working example for sorting and filtering.

Data binding test page for sorting and filtering

Right click on the page and View page Source.

Hope it helps

Regards,

Jeffin