A role using Filter to conditionnaly compute its data. More...
Import Statement: | import Felgo 4.0 |
Since: | Felgo 2.18.1 |
Inherits: |
A SwitchRole is a ProxyRole that computes its data with the help of Filter. Each top level filters specified in the SwitchRole is evaluated on the rows of the model, if a Filter evaluates to true, the data of the SwitchRole for this row will be the one of the attached SwitchRole.value property. If no top level filters evaluate to true, the data will default to the one of the defaultRoleName (or the defaultValue if no defaultRoleName is specified).
In the following example, the favoriteOrFirstNameSection
role is equal to *
if the favorite
role of a row is true, otherwise it's the same as the firstName
role :
SortFilterProxyModel { sourceModel: contactModel proxyRoles: SwitchRole { name: "favoriteOrFirstNameSection" filters: ValueFilter { roleName: "favorite" value: true SwitchRole.value: "*" } defaultRoleName: "firstName" } }
See also FilterContainer.
defaultRoleName : string |
This property holds the default role name of the role. If no filter match a row, the data of this role will be the data of the role whose name is defaultRoleName
.
defaultValue : var |
This property holds the default value of the role. If no filter match a row, and no defaultRoleName is set, the data of this role will be
defaultValue
.
This property holds the list of filters for this proxy role. The data of this role will be equal to the attached SwitchRole.value property of the first filter that matches the model row.
See also Filter and FilterContainer.
name : string |
This property holds the role name of the proxy role.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: