POST
|
Alright, I deleted the original folder and redid the tutorial, now changing it to es6. That solved it, thank you very much! The night is saved! Best regards!
... View more
11-24-2020
11:01 AM
|
1
|
0
|
840
|
POST
|
Hello, Thank you very much for the response! Do you mean changing the "target": to "ES6"? or am I missing something? Could you maybe elaborate. I am mainly a python and R programmer, if this helps. Best regards,
... View more
11-24-2020
10:51 AM
|
1
|
0
|
844
|
POST
|
I followed this tutorial: https://developers.arcgis.com/javascript/latest/guide/typescript-setup/ yet when I have done EXACTLY as it is stated in the tutorial now several times today, it returns several errors when writing "tsc main.ts". It seems to be an error with the package implementation, as typescript is unable to import ESRI from the main.ts file as described in the tutorial. I doubt it is a local issue as my 12 students are all receiving the same error. I assigned this as an exam last year with no issues, yet now me and all my current students are unable to get this tutorial to work. Urgent help is needed as this is an exam project at the course I am teaching. Best regards,
... View more
11-24-2020
08:55 AM
|
1
|
3
|
877
|
POST
|
By the way the example code I provided is the tutorial code supplied here: Filter a feature layer | ArcGIS API for JavaScript 4.13 Basically I am looking to turn this into a widget 🙂
... View more
11-11-2019
05:56 PM
|
1
|
0
|
871
|
POST
|
Hello all, I am new to ESRI as well as JavaScript. I am currently trying to develop a custom widget that takes attributes of a field within a FeatureLayer and gives you the option to filter between them. So the structure would be this: ---- [FeatureLayer] ------ [FIELD] ---------- [ATTRIBUTES: x,y,z,...,] With the widget then giving you the ability to input a FeatureLayer, a specific FIELD within the FeatureLayer and which ATTRIBUTES within that FIELD you would like to filter and outputting a drop down menu on the map as a selector. Code wise I have this: [FILE] main.ts ----------------------------------------------------------------------------------- //// preamble with all import [PACKAGE] from "PLACE". //BaseMap const map = new EsriMap({ basemap: "TYPE" }); //Widget view const view = new MapView({ map: map, container: "viewDiv", }); //FeatureLayer const layer = new FeatureLayer({ id: "FIELD", url: "URL", outFields: ["FIELD"], }); map.add(layer); var CustomFilter = new CustomWidget({ // VARIABLES HERE }); view.ui.add(CustomFilter, "top-right"); ----------------------------------------------------------------------------------- [FILE] and the corresponding CustomWidget.tsx file: ----------------------------------------------------------------------------------- /// <amd-dependency path="esri/core/tsSupport/declareExtendsHelper" name="__extends" /> /// <amd-dependency path="esri/core/tsSupport/decorateHelper" name="__decorate" /> //// preamble with all import [PACKAGE] from "PLACE". @subclass("CustomWidget") class CustomWidget extends declared(Widget) { // CODE GOES HERE } export = FilterWidget; ----------------------------------------------------------------------------------- as a reference, I got it to work without being a widget using the following code; ----------------------------------------------------------------------------------- // Display a drop-down menu for filtering the FeatureLayer var sqlExpressions = ["[ATTRIBUTE1] = [VALUE1] ", "[ATTRIBUTE2] = [VALUE2]", "[ATTRIBUTE3] = [VALUE3]"]; var selectFilter = document.createElement("select"); selectFilter.setAttribute("class", "esri-widget esri-select"); selectFilter.setAttribute("style", "width: 275px; font-family: Avenir Next W00; font-size: 1em;"); sqlExpressions.forEach(function(sql){ var option = document.createElement("option"); option.value = sql; option.innerHTML = sql; selectFilter.appendChild(option); }); view.ui.add(selectFilter, "top-right"); // Filter the drop-down menu options based on title attribute function setFeatureLayerViewFilter(expression: any) { view.whenLayerView(layer).then(function(featureLayerView: any) { featureLayerView.filter = { where: expression }; }); } selectFilter.addEventListener('change', function(event) { setFeatureLayerViewFilter((event.target as HTMLInputElement).value); }); ----------------------------------------------------------------------------------- Any help on how to get started writing this code or converting it into a widget would be much appreciated. I have tried gathering information on the ESRI ecosystem but I need a little more help if possible 🙂 Thank you in advance
... View more
11-11-2019
05:41 PM
|
0
|
1
|
1150
|
Title | Kudos | Posted |
---|---|---|
1 | 11-24-2020 10:51 AM | |
1 | 11-24-2020 11:01 AM | |
1 | 11-24-2020 08:55 AM | |
1 | 11-11-2019 05:56 PM |
Online Status |
Offline
|
Date Last Visited |
11-24-2020
12:31 PM
|