Hi, in this blog I'm going to explain about how to display the table entries with ODATA service having skip and top functionality in detail








onInit: function() {
var that = this;
var Btn = this.getView().byId("btn_previous");
Btn.setEnabled(false);
var oModel1 = new sap.ui.model.odata.ODataModel(url);
oModel1.read("/Material_DataSet?$top=5", null,null,true, function(oData){
var oODataJSONModel1 = new sap.ui.model.json.JSONModel();
oODataJSONModel1.setData(oData);
that.getView().setModel(oODataJSONModel1,"getData");
});
},
next : function() {
if(clicks < 0)
{
clicks = 0;
clicks += 1;
}
else{
clicks += 1;
};
num = clicks * 5;
count1;
if(num === count1)
{
var Btn = this.getView().byId("btn_next");
Btn.setEnabled(false);
}
if(num >= 5)
{
var Btn = this.getView().byId("btn_previous");
Btn.setEnabled(true);
}
this.data();
},
previous : function() {
clicks -= 1;
if(clicks <= 0)
{
num = 0;
}
else{
num = clicks * 5;
};
if(num < count1)
{
var Btn = this.getView().byId("btn_next");
Btn.setEnabled(true);
}
if(num === 0)
{
var Btn = this.getView().byId("btn_previous");
Btn.setEnabled(false);
}
this.data();
},
data: function(){
var that = this;
var oModel3 = new sap.ui.model.odata.ODataModel(url);
oModel3.read("/Material_DataSet?$top=5&$skip="+num+"", null,null,true, function(oData){
var oODataJSONModel3 = new sap.ui.model.json.JSONModel();
oODataJSONModel3.setData(oData);
that.getView().setModel(oODataJSONModel3,"getData");
});
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 36 | |
| 25 | |
| 17 | |
| 16 | |
| 16 | |
| 15 | |
| 13 | |
| 13 | |
| 12 | |
| 12 |