on 2018 Mar 13 3:36 PM
Hello All,
I am new to UI5 and still exploring.
What i have done so far:
-> Create a DB schema
-> Created a OData V4 using Java SDK - which can perform CRUD operation.
-> Created desitination for the Odata service
-> I have tested it working by creating a demo view with table and displays all the items with item aggregation - list binding
Requirement:
-> My actual requirement is to create a UI5 application with a simple view with 4 input fields and a save button.
-> When i click on Save it should perform the binding and save the data in the backend database.
-> Below is the code i have written so far for the controller but it is not working. Can someone suggest on what should be code to make the save button working.
sap.ui.define([
"sap/ui/core/mvc/Controller",
"book/BookAdd/utils/utils",
"sap/ui/model/json/JSONModel"
], function(Controller, utils, JSONModel) {
"use strict";
return Controller.extend("book.BookAdd.controller.Add", {
onInit: function() {
var oModel = new JSONModel({
data: {
"bookId": parseInt(utils.generateRandomNumber(100, 9999)),
"bookName": "",
"isbn": "",
"price": undefined,
"priceCurrency": utils.getDefaultCurrencyCode(),
"authorName": ""
}
});
this.getView().setModel(oModel, 'addModel');
},
onSave: function() {
var oView = this.getView();
var self = this;
var oBinding = this.oView.byId("simpleFormChange").getBinding({path: "/Book"});
var oDModel = oView.getModel();
var oContext = oBinding.create(oDModel.oData.data);
},
onCancel: function() {
}
});
});
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.