on 01-20-2017 11:52 AM
Hello!
I have some problems with update function. In OData Service it is everything working, there are no problems. I have tested. So, the problem is in Frontend in Form.
I can make update first time, but at the second time the program says about this problem.
If I update my page I can update my OData again but only one time.
I don't understand why my program says about duplicate id of input field...
There are my code of update function
onUpdate: function() {
var inputFragment = sap.ui.xmlfragment(
"Z_MOBILE.view.AddFragment",
this.getView().getController()
);
var Zeile1 = this.byId("Row1").getValue();
var ID1 = this.byId("ID").getValue();
var Activity = this.byId("Activity").getValue();
var Level = this.byId("Level").getValue();
var Plot = this.byId("Plot").getValue();
var Area = this.byId("Area").getValue();
var Description = this.byId("Description").getValue();
var ZzStartmonth = this.byId("ZzStartmonth").getValue();
var ZzActivitymonth = this.byId("ZzActivitymonth").getValue();
var ZzMinutetotal = this.byId("ZzMinutetotal").getValue();
var ZzMinutebase = this.byId("ZzMinutebase").getValue();
var Itground = this.byId("Itground").getValue();
var iteration = this.byId("Iteration").getValue();
var oModel = this.getView().getModel();
var data = {
ZzID: ID1,
ZzActivity: Activity,
ZzLevel: Level,
ZzPlot: Plot,
ZzArea: Area,
ZzDescription: Description,
ZzStartmonth: ZzStartmonth,
ZzActivitymonth: ZzActivitymonth,
ZzMinutetotal: ZzMinutetotal,
ZzMinutebase: ZzMinutebase,
ZzIteration: iteration,
ZzGroundarea: Itground
};
var dialog = new sap.m.Dialog({
title: 'Confirm',
type: 'Message',
content: new sap.m.Text({
text: 'Wollen Sie die Daten ändern?'
}),
beginButton: new sap.m.Button({
text: 'Submit',
press: function() {
oModel.update(
"/AllevoSat88Set(Zeile=" + "'" + Zeile1 + "'" +
",Version='0',Pjahr='2013',Coobject='0000009999',Setclass='0101',Kokrs='1000',Mandt='800')", data, {
merge: true
}
);
sap.m.MessageToast.show('Submit pressed!');
dialog.close();
}
}),
endButton: new sap.m.Button({
text: 'Cancel',
press: function() {
dialog.close();
}
}),
afterClose: function() {
dialog.destroy();
}
});
dialog.open();
}
Thank you for your help! Now it works!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue with fragment initialisation, remove it if not needed OR
declare var as global and assign fragment to it when its initial, as below:
this.inputFragment= ""; //global, may be in onInit function
if(this.inputFragment == ""){
this. inputFragment = sap.ui.xmlfragment(
"Z_MOBILE.view.AddFragment",
this.getView().getController()
);
}
Regards,
Akhilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whenever an Update is triggered, you are instantiating the fragment. So when you hit 'Update' second time, the earlier instance (upon first update) still exists, so no new instantiation fails due to duplicate id.
Why are you instantiating a fragment upon 'Update'?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.