Map as a selector
In this example, the french administrative regions are displayed first and the user click refines on the departments dataset. On the right section you can observe the applied filter on departments context and the list of departments returned. The ‘regions’ context is not affected and is not filtered. Note that it would also be possible to apply the filter on regions context, to do so, please have a look to the next resource of this page.
If your layer is displayed as raw or aggregation, you can configure a layer so that a click on an item triggers a refine on another context, using refineOnClickContext. One or more contexts can be defined:
Fields in use in: regions-et-collectivites-doutre-mer-france
(See it on userclub domain)
reg_code |
---|
94 |
53 |
44 |
11 |
Field in use in departements-et-collectivites-doutre-mer-france
(See it on userclub domain)
reg_code | dep_name |
---|---|
94 | Haute-Corse |
53 | Finistère |
44 | Moselle |
11 | Essonne |
<div class="row ods-box">
<ods-dataset-context context="regions,depts"
regions-dataset="regions-et-collectivites-doutre-mer-france"
regions-domain="userclub"
depts-dataset="departements-et-collectivites-doutre-mer-france"
depts-domain="userclub">
<div class="col-md-8">
<ods-map style="height:560px" scroll-wheel-zoom="false">
<ods-map-layer context="regions"
refine-on-click-context="depts"
refine-on-click-depts-map-field="reg_code"
refine-on-click-depts-context-field="reg_code"
refine-on-click-depts-replace-refine="true"
color="#3D3D3D">
</ods-map-layer>
</ods-map>
</div>
<div class="col-md-4">
<div ng-if="!depts.parameters['refine.reg_code']">
<h3 style="font-weight:600; margin-top: 40px">
Selectionnez une région sur la carte
</h3>
</div>
<div ng-if="depts.parameters['refine.reg_code']">
<span class="ods-button" ng-click="depts.parameters = {};">
Supprimer le filtre
</span>
<h3>Filtre actif : code_reg = {{ depts.parameters['refine.reg_code'] }}
</h3>
<h2>
Liste des départements
</h2>
<h4 ng-repeat="item in items" ods-results="items" ods-results-context="depts">
{{ item.fields.dep_name }}
</h4>
</div>
</div>
</ods-dataset-context>
</div>