sap.ui.comp.smartfilterbar.SmartFilterBar.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.comp.smartfilterbar.SmartFilterBar 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.comp.filterbar.FilterBar.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.ui.comp.smartfilterbar.SmartFilterBar.
Returns:
Adds some controlConfiguration to the aggregation controlConfiguration
.
Parameters:
Returns:
addFieldToAdvancedArea(sKey)
Searches for the filter field having the specified OData key and adds this filter field to the advanced area. If there is no corresponding field in the OData metadata, this method has no effect.
Parameters:
{string} | sKey | The key like specified in the OData metadata |
Adds some groupConfiguration to the aggregation groupConfiguration
.
Parameters:
Returns:
applyVariant(oVariant): void
Applies the current variant as opposed to fetchVariant. The variant is retrieved via the flex layer.
Parameters:
{object} | oVariant | The variant that must be applied. oVariant must contain a valid JSON object. |
Attaches event handler
fnFunction
to the
pendingChange
event of this
sap.ui.comp.smartfilterbar.SmartFilterBar
.
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.ui.comp.smartfilterbar.SmartFilterBar
itself.
This event is fired after the pending state of the FilterBar control 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.ui.comp.smartfilterbar.SmartFilterBar itself |
- Since:
- 1.36
Returns:
destroy()
Destroys the control.
Destroys all the controlConfiguration in the aggregation controlConfiguration
.
Returns:
Destroys all the groupConfiguration in the aggregation groupConfiguration
.
Returns:
Detaches event handler
fnFunction
from the
pendingChange
event of this
sap.ui.comp.smartfilterbar.SmartFilterBar
.
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 |
- Since:
- 1.36
Returns:
fetchVariant(): object
Retrieves the currently visible filters and the values for storing them as variants. The result will be passed on as a JSON object to the callee smart variant control.
Returns:
Fires event pendingChange
to attached listeners.
Parameters:
{Map} | mArguments? | The arguments to pass along with the event |
- Since:
- 1.36
Returns:
getBasicSearchControl(): object
Returns an instance of the control for the basic search.
Returns:
{object} | Basic search control |
getBasicSearchFieldName(): string
Gets current value of property
basicSearchFieldName
.
Name of the field that has to be the focus of basic search. This is only relevant for SmartFilterBar in combination with ValueHelpDialog.
Returns:
{string} | Value of property basicSearchFieldName |
getControlByKey(sKey): object|sap.ui.Control
Returns the control (if any) with the specified key (Property name in OData entity). Use just the property name as the key when getting a control from the basic area. Example: "CompanyCode" & Use "EntityName/GroupName.FieldName" format to get controls from groups. Example:"Account.CompanyCode"
Parameters:
{string} | sKey | The key as present in the OData property name/control configuration |
Returns:
{object|sap.ui.Control} | The control in the filter bar, if any |
Gets content of aggregation
controlConfiguration
.
Using control configurations you can add additional configuration to filter fields, for example set custom labels, change the order of fields, or change the filter field control type. Note: Changing the values here after the SmartFilter is initialized (initialise event was fired) has no effect.
Returns:
getEnableBasicSearch(): boolean
Gets current value of property
enableBasicSearch
.
Enables basic search field in the SmartFilterBar control. This must only be enabled for entities that support such search behavior.
Default value is false
.
Returns:
{boolean} | Value of property enableBasicSearch |
getEntityType(): string
Gets current value of property
entityType
.
The OData entity type whose metadata is used to create the SmartFilterBar. Note: Changing this value after the SmartFilterBar is initialized (initialise event was fired) has no effect.
Returns:
{string} | Value of property entityType |
getFilterData(bAllFilterData): object
Returns the data currently set in the filter data model.
Parameters:
{boolean} | bAllFilterData | Also include empty/invisible fields filter data |
Returns:
{object} | The JSON data in the filter bar |
getFilterDataAsString(bAllFilterData): string
Returns the data currently set in the filter data model as string.
Parameters:
{boolean} | bAllFilterData | Also include empty/invisible fields filter data |
Returns:
{string} | The JSON data string |
Returns an array of filters (sap.ui.model.Filter instances), for visible fields, that can be used to restrict the query result from OData.
The result of this method can directly be used during aggregation binding or OData read.
Parameters:
{string[]} | aFieldNames? | optional array of field names that filters should be returned, if not given all visible filters are returned |
Returns:
Gets content of aggregation
groupConfiguration
.
Provides the possibility to add additional configuration to groups. Groups are used to show fields in the advanced area of the SmartFilterBar. With additional configuration, you can for example set custom labels or change the order of groups. Note: Changing the values here after the SmartFilter is initialized (initialise event was fired) has no effect.
Returns:
getParameters(): object
Returns a parameter object that can be used to restrict the query result from OData in case of basic search.
Returns:
{object} | A parameter object containing OData query parameters |
ID of the element which is the current target of the association smartVariant
, or null
.
- Since:
- 1.38
Returns:
indexOfControlConfiguration(oControlConfiguration): int
Checks for the provided sap.ui.comp.smartfilterbar.ControlConfiguration
in the aggregation controlConfiguration
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
indexOfGroupConfiguration(oGroupConfiguration): int
Checks for the provided sap.ui.comp.smartfilterbar.GroupConfiguration
in the aggregation groupConfiguration
. and returns its index if found or -1 otherwise.
Parameters:
Returns:
{int} | The index of the provided control in the aggregation if found, or -1 otherwise |
Inserts a controlConfiguration into the aggregation controlConfiguration
.
Parameters:
{sap.ui.comp.smartfilterbar.ControlConfiguration} | oControlConfiguration | the controlConfiguration to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the controlConfiguration should be inserted at; for a negative value of iIndex , the controlConfiguration is inserted at position 0; for a value greater than the current size of the aggregation, the controlConfiguration is inserted at the last position |
Returns:
Inserts a groupConfiguration into the aggregation groupConfiguration
.
Parameters:
{sap.ui.comp.smartfilterbar.GroupConfiguration} | oGroupConfiguration | the groupConfiguration to insert; if empty, nothing is inserted |
{int} | iIndex | the 0 -based index the groupConfiguration should be inserted at; for a negative value of iIndex , the groupConfiguration is inserted at position 0; for a value greater than the current size of the aggregation, the groupConfiguration is inserted at the last position |
Returns:
isPending(): boolean
Checks the pending state of the FilterBar control
Returns:
{boolean} | true if at least one FilterItem element of the FilterBar control is pending |
Removes all the controls from the aggregation
controlConfiguration
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes all the controls from the aggregation
groupConfiguration
.
Additionally, it unregisters them from the hosting UIArea.
Returns:
Removes a controlConfiguration from the aggregation controlConfiguration
.
Parameters:
Returns:
Removes a groupConfiguration from the aggregation groupConfiguration
.
Parameters:
Returns:
Sets a new value for property
basicSearchFieldName
.
Name of the field that has to be the focus of basic search. This is only relevant for SmartFilterBar in combination with ValueHelpDialog.
When called with a value of null
or undefined
, the default value of the property will be restored.
Parameters:
{string} | sBasicSearchFieldName | New value for property basicSearchFieldName |
Returns:
Sets a new value for property
enableBasicSearch
.
Enables basic search field in the SmartFilterBar control. This must only be enabled for entities that support such search behavior.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Parameters:
{boolean} | bEnableBasicSearch | New value for property enableBasicSearch |
Returns:
setEntityType(sEntityTypeName)
The entity type name from OData metadata, for which the filter bar is created.
Parameters:
{string} | sEntityTypeName | type name |
setFilterData(oJson, bReplace)
Sets the data in the filter data model. The follow-on filterChange event is only triggered when none _CUSTOM data is set.
Parameters:
{object} | oJson | The JSON data in the filter bar |
{boolean} | bReplace | Replace existing filter data |
setFilterDataAsString(sJson, bReplace)
Sets the data in the filter data model as string.
Parameters:
{string} | sJson | The JSON data in the filter bar |
{boolean} | bReplace | Replace existing filter data |
Sets the associated smartVariant
.
Parameters:
- Since:
- 1.38
Returns:
getResourceUri(): string
Gets current value of property
resourceUri
.
Optional. The OData service URL. If it is not specified, the service URL from the OData model (this.getModel()) will be used. Note: Changing this value after the SmartFilterBar is initialized (initialise event was fired) has no effect.
- Deprecated:
- Since 1.29. Set an ODataModel as the main model on your control/view instead
Returns:
{string} | Value of property resourceUri |
setResourceUri(sResourceUri)
Uses the provided resource URI to fetch the OData metadata instead of using the default ODataModel (getModel()). You should only set this if you intend to get the metadata for the filter bar from elsewhere!
Parameters:
{string} | sResourceUri | The URI of the oData service from which the metadata would be read |
- Deprecated:
- Since 1.29. Set an ODataModel as the main model on your control/view instead