Commit 00210b7ae8fb7d2e956826b1586b7363819bb602
1 parent
a1dedcfa
controllet SPOD provider
Showing
2 changed files
with
29 additions
and
19 deletions
controllets/select-data-controllet/demo/index.html
| ... | ... | @@ -15,13 +15,13 @@ |
| 15 | 15 | |
| 16 | 16 | <body> |
| 17 | 17 | |
| 18 | - <select-data-controllet id="sd" data-url="https://data.issy.com/api/records/1.0/search?dataset=repartitiondeladetteparpreteursau3112n-feuille1"></select-data-controllet> | |
| 18 | + <select-data-controllet id="sd" data-url="https://data.issy.com/api/records/1.0/search?dataset=repartitiondeladetteparpreteursau3112n-feuille1&rows=10000"></select-data-controllet> | |
| 19 | 19 | <!--<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>--> |
| 20 | 20 | |
| 21 | 21 | <script> |
| 22 | 22 | ln["localization"] = "en"; |
| 23 | 23 | var sd = document.getElementById('sd'); |
| 24 | - sd._init(); | |
| 24 | + sd.init(); | |
| 25 | 25 | |
| 26 | 26 | // tvmt.addEventListener("tree-view-controllet_selected-fields", function (e) { |
| 27 | 27 | // console.log(tvmt.getFlatFields()); | ... | ... |
controllets/select-dataset-controllet/select-dataset-controllet.html
| ... | ... | @@ -481,30 +481,40 @@ |
| 481 | 481 | var that = this; |
| 482 | 482 | window.addEventListener("resize", function() { that._resize(); that._loadTreeMap();}); |
| 483 | 483 | |
| 484 | - this.providers = this.datasets["result"]["providers"]; | |
| 485 | - this.datasets = this.datasets["result"]["datasets"]; | |
| 484 | +// this.providers = that.datasets["result"]["providers"]; | |
| 485 | +// this.datasets = that.datasets["result"]["datasets"]; | |
| 486 | 486 | |
| 487 | - if(this.suggestedDatasets) { | |
| 488 | - this.tempDatasets = this.datasets; | |
| 489 | - this.datasets = this.suggestedDatasets.concat(this.datasets); | |
| 490 | - this.$.suggested_div.style.visibility = "visible"; | |
| 491 | - } | |
| 487 | + $.ajax({ | |
| 488 | + url: "/cocreation/ajax/get-all-dataset", | |
| 489 | + dataType: "json", | |
| 490 | + success: function(spodDatasets){ | |
| 491 | + | |
| 492 | + that.providers = $.extend(that.datasets["result"]["providers"], {99: {api_url: "/cocreation/ajax/get-all-dataset", id: "99", image_hash: "SPOD", title: "SPOD"}}); | |
| 493 | + that.datasets = $.merge(spodDatasets, that.datasets["result"]["datasets"]); | |
| 494 | + | |
| 495 | + if(that.suggestedDatasets) { | |
| 496 | + that.tempDatasets = that.datasets; | |
| 497 | + that.datasets = that.suggestedDatasets.concat(that.datasets); | |
| 498 | + that.$.suggested_div.style.visibility = "visible"; | |
| 499 | + } | |
| 492 | 500 | |
| 493 | - this.filteredDatasets = this.datasets; | |
| 501 | + that.filteredDatasets = that.datasets; | |
| 494 | 502 | |
| 495 | - this.prev = 1; | |
| 496 | - this.next = this.step; | |
| 497 | - this.length = this.filteredDatasets.length; | |
| 503 | + that.prev = 1; | |
| 504 | + that.next = that.step; | |
| 505 | + that.length = that.filteredDatasets.length; | |
| 498 | 506 | |
| 499 | - this.shownPrev = Math.min(this.prev, this.length); | |
| 500 | - this.shownNext = Math.min(this.next, this.length); | |
| 501 | - this.shownDatasets = this.filteredDatasets.slice(this.prev-1, this.next); | |
| 507 | + that.shownPrev = Math.min(that.prev, that.length); | |
| 508 | + that.shownNext = Math.min(that.next, that.length); | |
| 509 | + that.shownDatasets = that.filteredDatasets.slice(that.prev-1, that.next); | |
| 502 | 510 | |
| 503 | - this.$.list.scrollTarget = this.ownerDocument.documentElement; | |
| 511 | + that.$.list.scrollTarget = that.ownerDocument.documentElement; | |
| 504 | 512 | |
| 505 | - this._translate(); | |
| 513 | + that._translate(); | |
| 506 | 514 | |
| 507 | - this._loadTreeMap(); | |
| 515 | + that._loadTreeMap(); | |
| 516 | + } | |
| 517 | + }); | |
| 508 | 518 | }, |
| 509 | 519 | |
| 510 | 520 | _translate : function(){ | ... | ... |