diff --git a/controllets/select-data-controllet/demo/index.html b/controllets/select-data-controllet/demo/index.html index be0956e..0094353 100755 --- a/controllets/select-data-controllet/demo/index.html +++ b/controllets/select-data-controllet/demo/index.html @@ -15,13 +15,13 @@ <body> - <select-data-controllet id="sd" data-url="https://data.issy.com/api/records/1.0/search?dataset=repartitiondeladetteparpreteursau3112n-feuille1"></select-data-controllet> + <select-data-controllet id="sd" data-url="https://data.issy.com/api/records/1.0/search?dataset=repartitiondeladetteparpreteursau3112n-feuille1&rows=10000"></select-data-controllet> <!--<select-data-controllet id="sd" data-url="http://ckan.routetopa.eu/api/action/datastore_search?resource_id=642ceea8-711e-4124-b450-0d23010c44e6"></select-data-controllet>--> <script> ln["localization"] = "en"; var sd = document.getElementById('sd'); - sd._init(); + sd.init(); // tvmt.addEventListener("tree-view-controllet_selected-fields", function (e) { // console.log(tvmt.getFlatFields()); diff --git a/controllets/select-dataset-controllet/select-dataset-controllet.html b/controllets/select-dataset-controllet/select-dataset-controllet.html index 4684343..8b6d7fc 100755 --- a/controllets/select-dataset-controllet/select-dataset-controllet.html +++ b/controllets/select-dataset-controllet/select-dataset-controllet.html @@ -481,30 +481,40 @@ var that = this; window.addEventListener("resize", function() { that._resize(); that._loadTreeMap();}); - this.providers = this.datasets["result"]["providers"]; - this.datasets = this.datasets["result"]["datasets"]; +// this.providers = that.datasets["result"]["providers"]; +// this.datasets = that.datasets["result"]["datasets"]; - if(this.suggestedDatasets) { - this.tempDatasets = this.datasets; - this.datasets = this.suggestedDatasets.concat(this.datasets); - this.$.suggested_div.style.visibility = "visible"; - } + $.ajax({ + url: "/cocreation/ajax/get-all-dataset", + dataType: "json", + success: function(spodDatasets){ + + that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}}); + that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]); + + if(that.suggestedDatasets) { + that.tempDatasets = that.datasets; + that.datasets = that.suggestedDatasets.concat(that.datasets); + that.$.suggested_div.style.visibility = "visible"; + } - this.filteredDatasets = this.datasets; + that.filteredDatasets = that.datasets; - this.prev = 1; - this.next = this.step; - this.length = this.filteredDatasets.length; + that.prev = 1; + that.next = that.step; + that.length = that.filteredDatasets.length; - this.shownPrev = Math.min(this.prev, this.length); - this.shownNext = Math.min(this.next, this.length); - this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next); + that.shownPrev = Math.min(that.prev, that.length); + that.shownNext = Math.min(that.next, that.length); + that.shownDatasets = that.filteredDatasets.slice(that.prev-1, that.next); - this.$.list.scrollTarget = this.ownerDocument.documentElement; + that.$.list.scrollTarget = that.ownerDocument.documentElement; - this._translate(); + that._translate(); - this._loadTreeMap(); + that._loadTreeMap(); + } + }); }, _translate : function(){