Entry filters
An infoj entry with filter adds an option to the filter panel of its layer; see layer filter for which entries are listed. Selecting it adds a card, whose input writes a filter expression for the entry field into layer.filter.current.[1]
filter: true derives the type from entry.type: text → like, and numeric, integer, date, datetime and boolean alike. Other entry types are not listed. An empty object acts like true but fails the strict schema. A string is the type; an object needs type, or it is skipped with a warning, as is an unknown type.[2]
type | Input | Writes | Keys |
|---|---|---|---|
like, match | Text input | like or match with the text | leading_wildcard |
in, ni | Checkboxes, a dropdown or a searchbox of values | in or ni with the selected values | in, ni, dropdown, dropdown_pills, dropdown_search, searchbox, placeholder |
numeric, integer | Range slider and inputs | gte and lte | min, max, step, prefix, suffix, label_a, label_b, histogram |
date, datetime | Date inputs "after" and "before" | gt and lt in epoch seconds | |
boolean, null | Checkbox | boolean or null | label |
meta adds a text to any card.
Behaviour
inandniwithout a value array query the distinct values of the field with thedistinct_valuestemplate, filtered by the other current filters. A configuredinorniarray is offered as is.[1:1]- A range filter merges its entry, so
entry.min,max,step,prefixandsuffixapply unless the filter sets them. Bounds which are not set are queried with thefield_minmaxtemplate. A range with configured bounds filters the layer as soon as the card opens. histogramdraws the built-inhistogramdataview with thehistogramquery template of the field; an object setsoptionsorqueryparams, eg.buckets.
Pitfalls
- With
layer.filter.viewport, the queried minimum and maximum of the viewport replace configuredminandmax. - The date filters compare epoch seconds; the column must be numeric epoch seconds for them to match.
likematches the start of the value; commas in the input are alternatives.matchcompares the full text, soleading_wildcardonly helpslike.minmax_queryis documented in older JSDoc but not read; the range always queriesfield_minmax.
Examples
A countries layer whose panel filters the name, continent, subregion and population.
json
{
"dbs": "DEVDB",
"locale": {
"layers": {
"countries": {
"display": true,
"format": "geojson",
"table": "naturalearth.countries",
"geom": "geom_4326",
"srid": "4326",
"qID": "id",
"infoj": [
{ "type": "key" },
{ "title": "Name", "field": "name", "filter": { "type": "like", "leading_wildcard": true } },
{
"title": "Continent",
"field": "continent",
"filter": { "type": "in", "dropdown_pills": true, "placeholder": "Select continents" }
},
{ "title": "Subregion", "field": "subregion", "filter": { "type": "ni", "searchbox": true } },
{
"title": "Population",
"field": "pop_est",
"type": "integer",
"filter": { "type": "integer", "min": 0, "meta": "Estimated population", "histogram": true, "label_a": "At least", "label_b": "At most" }
}
]
}
}
}
}