Is used to rate content. The amount of rating symbols can be specified, as well as the URIs to the image icons which shall be used as rating symbols. When the user performs a rating, an event is fired.
Since: 1.14.
Event Summary
change(oControlEvent)The event is fired when the user has done a rating. liveChange(oControlEvent)This event is triggered during the dragging period, each time the rating value changes. Method Summary
sap.m.RatingIndicator.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.RatingIndicator with name sClassName
and enriches it with the information contained in oClassInfo
. addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy
. addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy
. attachChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the change
event of this sap.m.RatingIndicator
. attachLiveChange(oData?, fnFunction, oListener?)Attaches event handler fnFunction
to the liveChange
event of this sap.m.RatingIndicator
. bindValue(oBindingInfo)Binds property value
to model data. detachChange(fnFunction, oListener)Detaches event handler fnFunction
from the change
event of this sap.m.RatingIndicator
. detachLiveChange(fnFunction, oListener)Detaches event handler fnFunction
from the liveChange
event of this sap.m.RatingIndicator
. fireChange(mArguments?)Fires event change
to attached listeners. fireLiveChange(mArguments?)Fires event liveChange
to attached listeners. getAriaDescribedBy()Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy
. getAriaLabelledBy()Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
. getEnabled()Gets current value of property enabled
. getValue()Gets current value of property value
. removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy
. removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy
. setEnabled(bEnabled)Sets a new value for property enabled
. setIconHovered(sURI)Sets the hovered icon without rerendering the control. setIconSelected(sURI)Sets the selected icon without rerendering the control. setMaxValue(iMaxValue)Sets a new value for property maxValue
. setVisualMode(sVisualMode)Sets a new value for property visualMode
. addStyleClass,
allowTextSelection,
attachBrowserEvent,
attachValidateFieldGroup,
checkFieldGroupIds,
clone,
detachBrowserEvent,
detachValidateFieldGroup,
fireValidateFieldGroup,
getBusy,
getBusyIndicatorDelay,
getControlsByFieldGroupId,
getFieldGroupIds,
getIdForLabel,
getRenderer,
getVisible,
hasStyleClass,
invalidate,
isBusy,
placeAt,
removeStyleClass,
rerender,
setBusy,
setBusyIndicatorDelay,
setFieldGroupIds,
setVisible,
toggleStyleClass,
triggerValidateFieldGroup $,
addCustomData,
addDependent,
addEventDelegate,
applyFocusInfo,
bindElement,
data,
destroy,
destroyCustomData,
destroyDependents,
destroyLayoutData,
destroyTooltip,
enhanceAccessibilityState,
findElements,
fireEvent,
focus,
getCustomData,
getDependents,
getDomRef,
getElementBinding,
getFocusDomRef,
getFocusInfo,
getInterface,
getLayoutData,
getMetadata,
getTooltip,
getTooltip_AsString,
getTooltip_Text,
indexOfCustomData,
indexOfDependent,
insertCustomData,
insertDependent,
prop,
removeAllCustomData,
removeAllDependents,
removeCustomData,
removeDependent,
removeEventDelegate,
setLayoutData,
setTooltip,
toString,
unbindElement addAggregation,
addAssociation,
applySettings,
attachFormatError,
attachModelContextChange,
attachParseError,
attachValidationError,
attachValidationSuccess,
bindAggregation,
bindContext,
bindObject,
bindProperty,
destroyAggregation,
detachFormatError,
detachModelContextChange,
detachParseError,
detachValidationError,
detachValidationSuccess,
findAggregatedObjects,
fireFormatError,
fireModelContextChange,
fireParseError,
fireValidationError,
fireValidationSuccess,
getAggregation,
getAssociation,
getBinding,
getBindingContext,
getBindingInfo,
getBindingPath,
getEventingParent,
getId,
getModel,
getObjectBinding,
getOriginInfo,
getParent,
getProperty,
hasModel,
indexOfAggregation,
insertAggregation,
isBound,
isInvalidateSuppressed,
isTreeBinding,
propagateMessages,
removeAggregation,
removeAllAggregation,
removeAllAssociation,
removeAssociation,
setAggregation,
setAssociation,
setBindingContext,
setModel,
setProperty,
unbindAggregation,
unbindContext,
unbindObject,
unbindProperty,
validateAggregation,
validateProperty Constructor Detail
new sap.m.RatingIndicator(sId?, mSettings?)
Constructor for a new RatingIndicator.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- Aggregations
- Events
- change : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
- liveChange : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
Parameters:
{string} | sId? | id for the new control, generated automatically if no id is given |
{object} | mSettings? | initial settings for the new control |
Event Detail
change(oControlEvent)
The event is fired when the user has done a rating.
Parameters:
liveChange(oControlEvent)
This event is triggered during the dragging period, each time the rating value changes.
Parameters:
{sap.ui.base.Event} | oControlEvent | |
{sap.ui.base.EventProvider} | oControlEvent.getSource | |
{object} | oControlEvent.getParameters | |
{float} | oControlEvent.getParameters.value | The current value of the rating after a live change event. |
Method Detail
sap.m.RatingIndicator.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.RatingIndicator with name
sClassName
and enriches it with the information contained in
oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
Returns a metadata object for class sap.m.RatingIndicator.
Returns:
Adds some ariaDescribedBy into the association ariaDescribedBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaDescribedBy | the ariaDescribedBy to add; if empty, nothing is inserted |
Returns:
Adds some ariaLabelledBy into the association ariaLabelledBy
.
Parameters:
{string|sap.ui.core.Control} | vAriaLabelledBy | the ariaLabelledBy to add; if empty, nothing is inserted |
Returns:
Attaches event handler
fnFunction
to the
change
event of this
sap.m.RatingIndicator
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.RatingIndicator
itself.
The event is fired when the user has done a rating.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.m.RatingIndicator itself |
Returns:
Attaches event handler
fnFunction
to the
liveChange
event of this
sap.m.RatingIndicator
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.RatingIndicator
itself.
This event is triggered during the dragging period, each time the rating value changes.
Parameters:
{object} | oData? | An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
{function} | fnFunction | The function to be called when the event occurs |
{object} | oListener? | Context object to call the event handler with. Defaults to this sap.m.RatingIndicator itself |
Returns:
Binds property
value
to model data.
See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo
Parameters:
{object} | oBindingInfo | The binding information |
Returns:
Detaches event handler
fnFunction
from the
change
event of this
sap.m.RatingIndicator
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Detaches event handler
fnFunction
from the
liveChange
event of this
sap.m.RatingIndicator
.
The passed function and listener object must match the ones used for event registration.
Parameters:
{function} | fnFunction | The function to be called, when the event occurs |
{object} | oListener | Context object on which the given function had to be called |
Returns:
Fires event
change
to attached listeners.
Expects the following event parameters:
value
of type int
The rated value
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
Fires event
liveChange
to attached listeners.
Expects the following event parameters:
value
of type float
The current value of the rating after a live change event.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
Returns:
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo} |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy
.
Returns:
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy
.
Returns:
getEnabled(): boolean
Gets current value of property
enabled
.
Value "true" is required to let the user rate with this control. It is recommended to set this parameter to "false" for the "Small" size which is meant for indicating a value only
Default value is true
.
Returns:
{boolean} | Value of property enabled |
Gets current value of property
iconHovered
.
The URI to the icon font icon or image that will be displayed for hovered rating symbols. A star icon will be used if the property is not set
Returns:
Gets current value of property
iconSelected
.
The URI to the icon font icon or image that will be displayed for selected rating symbols. A star icon will be used if the property is not set
Returns:
Gets current value of property
iconSize
.
The Size of the image or icon to be displayed. The default value depends on the theme. Please be sure that the size is corresponding to a full pixel value as some browsers don't support subpixel calculations. Recommended size is 1.375rem (22px) for normal, 1rem (16px) for small, and 2rem (32px) for large icons correspondingly.
Returns:
Gets current value of property
iconUnselected
.
The URI to the icon font icon or image that will be displayed for all unselected rating symbols. A star icon will be used if the property is not set
Returns:
getMaxValue(): int
Gets current value of property
maxValue
.
The number of displayed rating symbols
Default value is 5
.
Returns:
{int} | Value of property maxValue |
getValue(): float
Gets current value of property
value
.
The indicated value of the rating
Default value is 0
.
Returns:
{float} | Value of property value |
Gets current value of property
visualMode
.
Defines how float values are visualized: Full, Half (see enumeration RatingIndicatorVisualMode)
Default value is Half
.
Returns:
Removes all the controls in the association named ariaDescribedBy
.
Returns:
Removes all the controls in the association named ariaLabelledBy
.
Returns:
Removes an ariaDescribedBy from the association named ariaDescribedBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaDescribedBy | The ariaDescribedByto be removed or its index or ID |
Returns:
Removes an ariaLabelledBy from the association named ariaLabelledBy
.
Parameters:
{int|string|sap.ui.core.Control} | vAriaLabelledBy | The ariaLabelledByto be removed or its index or ID |
Returns:
Sets a new value for property
enabled
.
Value "true" is required to let the user rate with this control. It is recommended to set this parameter to "false" for the "Small" size which is meant for indicating a value only
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Parameters:
{boolean} | bEnabled | New value for property enabled |
Returns:
Sets the hovered icon without rerendering the control.
Parameters:
Returns:
Sets the selected icon without rerendering the control.
Parameters:
Returns:
Sets the icon size value. The method is automatically updating the UI components if the control has been rendered before.
Parameters:
Returns:
Sets the unselected icon without rerendering the control.
Parameters:
Returns:
Sets a new value for property
maxValue
.
The number of displayed rating symbols
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is 5
.
Parameters:
{int} | iMaxValue | New value for property maxValue |
Returns:
Sets the rating value. The method is automatically checking whether the value is in the valid range of 0-
maxValue and if it is a valid number. Calling the setter with null or undefined will reset the value to it's default.
Parameters:
{float} | fValue | The rating value to be set. |
Returns:
Sets a new value for property
visualMode
.
Defines how float values are visualized: Full, Half (see enumeration RatingIndicatorVisualMode)
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Half
.
Parameters:
Returns:
Unbinds property value
from model data.
Returns: