Show TOC

Adding Items to the User Preferences Dialog BoxLocate this document in the navigation structure

Methods of the Renderer API that add an item to the User Preferences dialog box.

Syntax

addUserPreferencesEntry(entryObject);

This method is part of the SAPUI5 sap.ushell.renderers.fiori2 namespace. For more information, see SAPUI5 Demo Kit: Controls Start of the navigation path API REFERENCE Next navigation step sap.ushell.renderers.fiori2 Next navigation step Renderer End of the navigation path.

Properties of the entryObject Object

Property

Type

Description

entryHelpID

String

(Optional) The ID of the object.

title

String

The title of the entry to be presented in the list in the User Preferences dialog box. We recommend using the string from the translation bundle.

value

{String}/{Function}

A string to be presented as the value of the entry OR a function to call to retrieve a jQuery.Deferred.promise object.

onSave

Function

A function to call to retrieve a jQuery.Deferred.promise object when the user clicks Save in the User Preferences dialog box.

If an error occurs, pass the error message via the jQuery.Deferred.promise object. Errors are displayed in the log.

onCancel

Function

A function to call to close the User Preferences dialog box without saving any changes.

content

Function

A function to call to retrieve a jQuery.Deferred.promise object that consists of a sap.ui.core control to be displayed in a follow-on dialog box. An SAPUI5 view instance can also be returned.

The function is called each time the user opens the User Preferences dialog box.

Example
Sample Code
<SCRIPT language ="JavaScript">

var oRenderer = sap.ushell.Container.getRenderer("fiori2");
var oEntry = {
  title: "title",
  value: function() {
      return jQuery.Deferred().resolve("entryTitleToBeDisplayed");
  },
  content: function() {
      var deferred = jQuery.Deferred();
      deferred.resolve(new sap.m.Button("userPrefEntryButton", {text: "Button"}));
      return jQuery.Deferred().resolve(new sap.m.Button("userPrefEntryButton", {text: "Button"}));
  },
  onSave: function() {
      return jQuery.Deferred().resolve();
  };
oRenderer.addUserPreferencesEntry(oEntry);   

   
<SCRIPT>

Additional Information
  • The content function, which is provided as part of the entry configuration object, is called each time the user opens the User Preferences dialog box.

  • The SAPUI5 view or SAPUI5 control that returns as the result of the content function is destroyed when the user closes the User Preferences dialog box (by clicking on Cancel or Save). This is triggered by the generic User Preferences dialog box and is not the responsibility of the plug-in developer.