Location editing
An entry with edit shows an input instead of its value; edit: true is the same as edit: {}. Changed values are saved together: the location sends them to the location_update query, then shows them as saved.[1] Updates of one location run one after another, in order.
Restrict layers with editable entries to the users who edit them with layer roles.
Inputs
- Text:
placeholder,maxlength.optionsturns the input into a dropdown, or radio buttons withradio. An emptyoptionsarray, ordynamic: true, loads the options withedit.query,distinct_valuesof the field by default.[2]arraySeparatorsplits text into an array. - Numbers:
minandmaxbound the value,stepsets the increment, andrangeadds a slider.[3] - Geometry entries:
drawenables drawing a new geometry,modify_btnediting the existing one,deleteremoving it, andsnapsnapping to other features;modify_labelanddelete_labellabel the buttons. entry.defaultfills a new location's value; see location infoj.
After saving
dependentslists fields of the location which are reloaded after this entry is saved, eg. values computed by a trigger.dependents_layerslists layer keys which are reloaded.layer.deleteLocationadds a delete button to the location view.layer.toggleLocationViewEditsstarts the view read-only, with a button to switch editing on.[4]
Pitfalls
entry.stepsets the step to 1 whenever it is set, because of operator precedence in the numeric entry. Useedit.step.layer.edit.deleteandlayer.draw.deleteare legacy forms ofdeleteLocation.
Examples
Retailer chosen from the values in the table, and a bounded size field. The example layer is read in tests; editing writes to the devdb only in a running view.
json
{
"dbs": "DEVDB",
"locale": {
"layers": {
"retail_points": {
"display": true,
"format": "wkt",
"table": "geodata.uk_glx_open_retail_points",
"geom": "geom_p_4326",
"srid": "4326",
"qID": "id",
"toggleLocationViewEdits": true,
"infoj": [
{ "title": "Retailer", "field": "retailer", "edit": { "options": [] } },
{ "title": "Name", "field": "store_name", "edit": { "maxlength": 80 } },
{ "title": "Size band", "field": "size_band", "edit": { "options": [], "radio": true }, "dependents": ["pqi"] },
{ "title": "PQI", "field": "pqi" }
]
}
}
}
}