The query_button [location] entries module exports the query_button method as default.

Requires

Methods

(async, inner) query(entry)

Will be called by the onclick event of the query_button element.

The entry.location.view will be disabled.

Runs the entry.query template with the provided entry.queryparams.

The entry.host defaults to the entry.mapview.host concatenated with the /api/query path.

The location.layer will reload after the query response with the entry.reload flag.

The entry values of fields in the entry.dependents array will be synched after the query has been resolved.

The entry.alert message will be displayed after the query has been resolved.

The entry.location.view will be enabled by calling the updateInfo element event.

Parameters:
NameTypeDescription
entryinfoj-entry

type:query_button infoj entry.

Properties
NameTypeAttributesDescription
entry.querystring

Query template.

entry.queryparamsObject<optional>

Parameter for query in template.

entry.hoststring<optional>

The host for the query.

entry.alertstring<optional>

Alert message after the query has responded.

entry.reloadboolean<optional>

Reload location.layer if true.

entry.dependentsArray<optional>

Reload dependent entry.field values.

(inner) query_button(entry) → {HTMLElement}

mapp.ui.locations.entries.query_button(entry)

Returns a button element. The query(entry) method will be called by the button onclick event.

{
  "label": "Snap to Postal Sector",
  "type": "query_button",
  "query": "catchment_statistics_snap_to_postal_sector",
  "queryparams": {
    "id": true
  },
  "alert": "Query has executed!",
  "reload": true,
  "dependents": [
    "geom_3857",
    "perimeter",
    "area"
  ]
}
Parameters:
NameTypeDescription
entryinfoj-entry

type:query_button infoj entry.

Returns:

Location view entry node.

Type: 
HTMLElement