Show TOC

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

Use the methods of the Renderer API to add items to the users' Settings dialog box.

Syntax

addUserPreferencesEntry(entryObject);

This method is part of the SAPUI5 sap.ushell.renderers.fiori2 namespace. For more information, go to SAPUI5 Demo Kit: Controls and then navigate to 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 Settings 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 Settings 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 Settings 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 Settings 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 Settings dialog box.

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