on 05-17-2021 9:56 AM
onInit: function () {
var otable= this.getView().byId("Table1");
var oModel = new sap.ui.model.json.JSONModel();
oModel.loadData("model/data.json");
var oModel1= this.getView().setModel(oModel);
//Initial sorting
var sPath, bdesc, aSorters=[] ;
sPath ="EmpNo";
bdesc = false;
aSorters.push(new Sorter(sPath, bdesc));
this.byId("Table1").getBinding("rows").sort(aSorters);
},
onSort : function(oEvent) {
var mParams = oEvent.getParameters(),
sPath,
bDescending,
aSorters = [];
//sPath = mParams.sortItem.getKey();
sPath="EmpName";
// bDescending = mParams.sortDescending;
bDescending = false ;
aSorters.push(new Sorter(sPath, bDescending));
var oList = this.byId("Table1");
this.oList.getBinding("rows").sort(aSorters); }
just replace
var oList = this.byId("Table1");
this.oList.getBinding("rows").sort(aSorters);
with
var oList = this.byId("Table1");
oList.getBinding("rows").sort(aSorters);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
11 | |
10 | |
8 | |
8 | |
6 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.