index.html
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<head>
<script src="../../shared_js/jquery-1.11.2.min.js"></script>
<script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="../tree-view-controllet.html" />
</head>
<body>
<style>
.container {
display: flex;
flex-direction: row;
}
#tree_container {
width: 300px;
}
#fields_container {
margin-left: 100px;
}
</style>
<div class="container">
<div id="tree_container">
<tree-view-controllet id="tree" root-name="data" opened-path="records,geometry" preselected-fields='["records,datasetid", "records,recordid", "nhits"]'></tree-view-controllet>
</div>
<div id="fields_container">
<h3>Selected fields:</h3>
<p id="fields"> </p>
</div>
</div>
<script>
var tree = document.getElementById('tree');
var fields = document.getElementById('fields');
$.ajax({
url: 'https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse',
dataType: "json",
success: function(data){
tree.setAttribute("json-data", JSON.stringify(data));
tree.ready();//chrome
}
});
tree.addEventListener("tree-view-controllet_selected-fields", function (e) {
fields.innerHTML = e.detail.fields;
// console.log(tree.getFlatFields());
// console.log(tree.getFields());//firefox console.log does not recognize associative array?
});
</script>
</body>
</html>
<!--urls:-->
<!--http://dati.lazio.it/catalog/api/action/datastore_search?resource_id=114baf3d-6d4f-42ff-b4af-481beef59ae1-->
<!--url: 'http://ckan.routetopa.eu/api/action/datastore_search?resource_id=73e02092-85a1-434e-85fe-0c9a43aa9a52&limit=5',-->
<!--url: 'https://data.issy.com/api/records/1.0/search?dataset=liste-des-restaurants-a-issy-les-moulineaux&sort=type&facet=type&facet=terrasse',-->
<!--url: 'https://data.issy.com/api/records/1.0/search?dataset=flux-rss-des-offres-demplois-a-issy-les-moulineaux&sort=published&facet=published&refine.published=2015',-->