Skip to content

Query

Query component will run the provided query and pass to child components.

Component

Name Description
component query
kind dispatch, user, related-user, triggers, orgs
id Unique id used to store the list results
query a query to execute, required if kind is dispatch or user.
child a child where we will supply data from the list to
options options

Options

Name Description
id supply id if kind is related-user
waitForReady true, false - wait for the query to complete before displaying, default is true
paging true, false, default to false. If true, use paging (ensure to provide maxHeight so)
maxHeight optional maxHeight, this is needed if paging is used
iconSize optional, if kind is user and paging is true, provide user profile icon size
limit number - this can also be provided via the query
refresh an array of save, delete, refresh actions that would trigger a refresh (example you want to refresh the query when user updated dispatch)
refreshDelay optional refresh delay in ms if refresh is defined, default to 500 ms
exclude optional, org kind only, an array of org id to exclude
include optional, org kind only, an array of org id to include, if not provided all user orgs are included
parent optional, org kind only, an array of parent org id
fromNetwork optional, org kind only, if true, fetch from network
fields optional string, org kind only, additional fields to query for (available fields are name, id, status, website, address, phone, parentId), only applicable if fromNetwork is true

Don't forget to put the kind of query.

Examples

{
    "component": "query",
    "kind": "dispatch",
    "query": "id:6a8a5db9-ab7d-4b5a-b488-38458cd21c71",
    "child": {
        "component": "grid",
        ...
    }
}

Orgs

Query a list of user's org and filter it out based on the filtering options. The properties available are name, id, status, website, address, phone, parentId as well as any fields include in fields options.

{
    "component": "query",
    "kind": "orgs",
    "options": {
        "refresh": [
            "refresh"
        ],
        "fromNetwork": true,
        "fields": "displayName, color, title"
    },
    "id": "orgs",
    "child": {
        "component": "iterator",
        "dataSource": "data:orgs",
        "child": {
            "component": "text",
            "text": "{data.name}"
        }
    }
}

Paging

{
    "component": "query",
    "kind": "user",
    "query: "all users",
    "options": {
        "paging": true,
        "maxHeight": "400px",
        "refresh": [
            "refresh"
        ]
    },
    "child": {
        "component": "iterator",
        "child": {
            "component": "grid",
            "text": "{data.name}"
        }
    }
}

Triggers

{
    "component": "query",
    "kind": "triggers",
    "options": {
        "refresh": [
            "refresh"
        ]
    },
    "id": "triggers",
    "child": {
        "component": "iterator",
        "dataSource": "data:triggers",
        "child": {
            "component": "grid",
            ...
        }
    }
}

User

{
    "component": "query",
    "kind": "user",
    "query: "all users",
    "options": {
        "refresh": [
            "refresh"
        ]
    },
    "child": {
        "component": "iterator",
        "child": {
            "component": "grid",
            ...
        }
    }
}
{
    "component": "query",
    "kind": "related-user",
    "options": {
        "id": "6a8a5db9-ab7d-4b5a-b488-38458cd21c71"
    },
    "child": {
        "component": "text",
        "text": "{user.dob}"
    }
}