Show TOC

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

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

Syntax

addUserPreferencesEntry(oConfig);

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

Properties of the oConfig 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.

Example
Sample Code
<SCRIPT language ="JavaScript">

var oRendererExtensions = jQuery.sap.getObject("sap.ushell.renderers.fiori2.RendererExtensions");

oRendererExtensions.addUserPreferencesEntry({
    title: "title",
    value: function() {
        return jQuery.Deferred().resolve("entryTitleToBeDisplayed");
    },
    content: function() {
        var deferred = jQuery.Deferred();

        window.setTimeout(function() {
            deferred.resolve(new sap.m.Button("userPrefEntryButton1", {text: "Button"}));
        }, 2000);

        return jQuery.Deferred().resolve(new sap.m.Button("userPrefEntryButton1", {text: "Button"}));

    },
    onSave: function() {
        
        return jQuery.Deferred().resolve();
    }
});

   
<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.