cancel
Showing results for 
Search instead for 
Did you mean: 

Table sorting

RyabovAlex
Advisor
Advisor
0 Kudos

Hello colleagues,

please advise.

I'm trying to have a simple sorting by column value.

1. The table is created like this:


var oTable = new sap.ui.table.Table({

  id: "Overview",

  title : "Table1",    

  });

2. Then I add a column:


oTable.addColumn(new sap.ui.table.Column({

  label : new sap.ui.commons.Label({text : "Column1"}),

  template : new sap.ui.commons.TextView().bindProperty("text","SENDER_NAME"),

   sortProperty : "SENDER_NAME",

   filterProperty : "SENDER_NAME",

  }));

3. Assign oData model:


oTable.setModel(oController.oModel);

4. Create Sorter:


var sort1 = new sap.ui.model.Sorter("P8_TOTAL");

5.Bind rows of Model to oTable


oTable.bindRows("/DASHBOARDSet",sort1);

6.Return table to View


  return oTable;

Seems like piece a cake, but it is not working.

No idea why. I've read many threads here and couldn't make it work.

Appreciate your help.

Thank you.

View Entire Topic
former_member182372
Active Contributor
0 Kudos

Alex, SAP just came up with client side sorting/filtering for OData model in 1.28:

The first steps towards client-side filtering/sorting on OData Model Data: the final implementation is planned for a later release, but a first experimentalversion is available in 1.28: by setting the “OperationMode" on a list binding to "Client", you can force the OData model to loadall data from the server and do sorting and filtering entirely in the browser, with no server roundtrip. Useful only when it is guaranteed that the count of data elements is low.

So, if you need client side sorting/filtering - use JsonModel as suggested before