on 03-20-2017 7:58 AM
Dear Developers,
i Have created fragment, it's open fine but close button for event is not trigger please suggestion me.
i wrote this code.
if (!this._parentoDialog) {
// var that = this;
this._parentoDialog = sap.ui.xmlfragment("hrapplication.view.createfinalpos", this);
parent.oviw.addDependent(this._parentoDialog);
}
var oJsonModel = new sap.ui.model.json.JSONModel(parent.oviw.arry);
var table=sap.ui.getCore().byId("idProductsTablefinalposition");
table.setModel(oJsonModel);
// toggle compact style
jQuery.sap.syncStyleClass("sapUiSizeCompact", parent.oviw, this._parentoDialog);
this._parentoDialog.open();
Hi,
Please check the below code and link for Opening and Closing of Fragment.
onOpenDialog : function () {
var oView = this.getView();
var oDialog = oView.byId("helloDialog"); // create dialog lazily
if (!oDialog) { // create dialog via fragment factory
oDialog = sap.ui.xmlfragment(oView.getId(), "sap.ui.demo.wt.view.HelloDialog", this); // connect dialog to view (models, lifecycle)
oView.addDependent(oDialog);
}
oDialog.open();
},
onCloseDialog : function () {
this.getView().byId("helloDialog").close();
}
Please let me know if you are getting any error.
Regards,
Somesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thank you for quick response, i got solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karthic Actully i wrote Dialog code in success parameters functionality. so it's not took this key word, but i display dialog and bind the
success response to dialog table.
var mParameters = {
success: function(data, oResponse) { //Success function//
var id=data.PositionId;
var id1 = data;
parent.oviw.arry.push(id1);
//var id=data.MainObjId;
if (!oDialog) {
var that = this;
var oDialog = sap.ui.xmlfragment("hrapplication.view.createfinalpos", that);
parent.oviw.addDependent(oDialog);
}
var oJsonModel = new sap.ui.model.json.JSONModel(arry);
table=sap.ui.getCore().byId("idProductsTablefinalposition");
table.setModel(oJsonModel);
// // toggle compact style
jQuery.sap.syncStyleClass("sapUiSizeCompact", parent.oviw, oDialog);
oDialog.open();
// sap.m.MessageBox.show("Position has been created Successfully " + id, {
// icon: sap.m.MessageBox.Icon.SUCCESS,
// title: "SUCCESS",
// actions: [sap.m.MessageBox.Action.OK],
// onClose: function(oAction) {
// if (oAction === "OK") {
// /* that.onClose1();
// */
// }
// }
// });
},
error: function(data, oResponse) { //Error function//
sap.m.MessageBox.show("Invalid", { //error msg box pop up//
icon: sap.m.MessageBox.Icon.ERROR,
title: "ERROR",
actions: [sap.m.MessageBox.Action.OK],
onClose: function(oAction) {
if (oAction === "OK") {
//
}
return true;
}
});
}
};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Agree with Somesh comment, to destroy memories in runtime you can follow up the below approach too. 🙂
onOpenDialog :function(){
var oView = this.getView();
var oDialog = oView.byId("helloDialog"); // create dialog lazily if(!oDialog){//createdialogvia fragment factory
oDialog =sap.ui.xmlfragment(oView.getId(),"sap.ui.demo.wt.view.HelloDialog", this); oDialog.afterClose(function(){ oDialog.destroy(); }); // Destroy the dialog
oView.addDependent(oDialog);}
oDialog.open();},
onCloseDialog :function(){
this.getView().byId("helloDialog").close(); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
11 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.