Skip to content

Context

User context

By default, user context (access via {user.xxx}) is the current logged in user. However, this can be changed by a combination of changeUser action and iterated query widget. User context can be reset by executing resetUserContext action.

Examples

List related users (usually children of a parent, the logged in user) and allow the parent (logged in user) to change context.

{
    "data": {
        "sources": [
            "id": "family",
            "kind": "user",
            "query": "current user, related as current"
        ]
    },
    "ux": {
        "component": "grid",
        "child": {
            "component": "iterator",
            "dataSource": "family",
            "child": {
                "componnet": "profile",
                "value": "{user.id}"
            },
            "onClick": {
                "target": "changeUser",
                "options": {
                    "user": "{user.id}",
                    "persistence": "restart"
                }
            }
        }
    }
}