var oRenderer = sap.ushell.Container.getRenderer("fiori2");
...
var oContainerService = sap.ushell.Container.getServiceAsync("Personalization");
//Call the getServiceAsync to get the Unified Shell's personalization service
oContainerService.then(function (oService) {
//The personalization service will be returned as parameter
oService.getContainer("ImportOption").done(function (oPContainer) {
//Use the personalization service to get container
//Check the method detail https://sapui5.hana.ondemand.com/sdk/#/api/sap.ushell.services.Personalization%23methods/getContaine...
//The container also will be returned as parameter
if (!oPContainer.containsItem("Option1")) {
oPContainer.setItemValue("Option1", false);
oPContainer.save();
}
var handlePress = function (e) {
var oDialog = new sap.m.Dialog({
content: [new sap.m.CheckBox({
text: "Option",
selected: oPContainer.getItemValue("Option1"),
select: function() {
oPContainer.setItemValue("Option1", !oPContainer.getItemValue("Option1"));
}
})],
endButton: new sap.m.Button({
text: "Confirm",
press: function (e) {
//Call save method to persist data
oPContainer.save();
e.getSource().getParent().close();
}.bind(this)
})
});
oDialog.open();
}
var button1 = new sap.m.Button({ text: "testmybutton", press: handlePress });
oRenderer.showActionButton([button1.getId()], false, ["home", "app"]);
var oServicePromise = sap.ushell.Container.getServiceAsync("Personalization").then(function(oService){ return oService});
var oContainerPromise = oServicePromise.then(function(oService){ return oService.getContainer("ImportOption")});
$.when(oContainerPromise).then(function(oContainer){
if (!oContainer.containsItem("Option1")) {
oContainer.setItemValue("Option1", false);
oContainer.save();
}
var handlePress = function (e) {
var oDialog = new sap.m.Dialog({
content: [new sap.m.CheckBox({
text: "Option",
selected: oContainer.getItemValue("Option1"),
select: function() {
oContainer.setItemValue("Option1", !oContainer.getItemValue("Option1"));
}
})],
endButton: new sap.m.Button({
text: "Confirm",
press: function (e) {
//Call save method to persist data
oPContainer.save();
e.getSource().getParent().close();
}.bind(this)
})
});
oDialog.open();
}
var button1 = new sap.m.Button({ text: "testmybutton", press: handlePress });
oRenderer.showActionButton([button1.getId()], false, ["home", "app"]);
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
23 | |
11 | |
10 | |
9 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 |