POST
|
Brand new to Javascript so I'm hoping I'm missing something simple here, but I have a very simple page cloned from the feature table with editing enabled sample code but swapped out my own feature layer. For the most part it works great but if I tell the table to sort on a column, it will select the correct feature but push updates to a different one. Here's where I select the record, I see the correct feature highlight. Changing the status field in the same record updates a different location. This only happens if I include direction: "asc" in one of the field configurations. Assuming there is a place for me to identify the objectid? Here's my page for reference. Thanks everyone <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> <title> FeatureTable widget with editing enabled | Sample | ArcGIS API for JavaScript 4.22 </title> <link rel="stylesheet" href="https://js.arcgis.com/4.22/esri/themes/light/main.css" /> <script src="https://js.arcgis.com/4.22/"></script> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #viewDiv { height: 50%; width: 100%; } .container { height: 50%; width: 100%; } </style> <script> require([ "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer", "esri/widgets/FeatureTable", "esri/widgets/Editor" ], (Map, MapView, FeatureLayer, FeatureTable,Editor) => { let featureLayer; const features = []; const map = new Map({ basemap: "streets-navigation-vector" }); const view = new MapView({ container: "viewDiv", map: map, center: [-95.75,29.18], zoom: 7, popup: { autoOpenEnabled: false } //disable popups }); view.when(() => { featureLayer = new FeatureLayer({ // URL to the service url: "https://xxxxxxxxxxxxxxxxx/FeatureServer/0", outFields: ["*"], title: "Emergency Reporting Areas" }); map.add(featureLayer); // Create the feature table const featureTable = new FeatureTable({ view: view, layer: featureLayer, editingEnabled: true, menuConfig: { items: [ { label: "Zoom to feature(s)", iconClass: "esri-icon-zoom-in-magnifying-glass", clickFunction: (event) => { zoomToSelectedFeature(); } } ] }, // Autocast the FieldColumnConfigs fieldConfigs: [ { name: "name", label: "Area Name", editable: false, direction: "asc" }, { name: "type", label: "Type", editable: false, }, { name: "boilwater", label: "Boil Water Notice?" }, { name: "evacuation", label: "Evacuation Status" }, { name: "poweroutage", label: "Power Outage?" }, { name: "highwater", label: "High Water?" } ], container: document.getElementById("tableDiv") }); const polyInfos = { layer: featureLayer, label:"name", updateEnabled: false, formTemplate: { // autocasts to FormTemplate elements: [ { // autocasts to FieldElement type: "field", fieldName: "name", label: "Area" }, { type: "field", fieldName: "type", label: "Type" }, { type: "field", fieldName: "poweroutage", label: "Power Outage" }, { type: "field", fieldName: "boilwater", label: "Boil Water?" }, { type: "field", fieldName: "evacuation", label: "Evacuation Status" } ] } }; const editor = new Editor({ view: view, layerInfos: [polyInfos], // It is possible to set snapping via the API by directly setting SnappingOptions in the Editor. This can also be toggled on/off using the CTRL key. By default snapping is not enabled, setting enabled to true toggles this. snappingOptions: { // Autocastable to snapping options enabled: true, // sets the global snapping option that controls both geometry constraints (self-snapping) and feature snapping. featureSources: [ { // Autocastable to FeatureSnappingLayerSource // Enable feature snapping on specified layer(s) layer: featureLayer } ] } }); // Get the FeatureLayer's layerView and listen for the table's selection-change event featureTable.on("selection-change", (changes) => { // If the selection is removed, remove the feature from the array changes.removed.forEach((item) => { const data = features.find((data) => { return data.feature === item.feature; }); if (data) { features.splice(features.indexOf(data), 1); } }); // If the selection is added, push all added selections to array changes.added.forEach((item) => { const feature = item.feature; features.push({ feature: feature }); }); }); view.ui.add(editor, "top-right"); function zoomToSelectedFeature() { // Create a query off of the feature layer const query = featureLayer.createQuery(); // Iterate through the features and grab the feature's objectID const featureIds = features.map((result) => { return result.feature.getAttribute(featureLayer.objectIdField); }); // Set the query's objectId query.objectIds = featureIds; // Make sure to return the geometry to zoom to query.returnGeometry = true; // Call queryFeatures on the feature layer and zoom to the resulting features featureLayer.queryFeatures(query).then((results) => { view.goTo(results.features).catch((error) => { if (error.name !== "AbortError") { console.error(error); } }); }); } }); }); </script> </head> <body> <div id="viewDiv"></div> <div class="container"> <div id="tableDiv"></div> </div> </body> </html>
... View more
02-03-2022
12:38 PM
|
1
|
0
|
293
|
POST
|
Update: Solved the problem by populating the null placeholder fields with URL parameters. This will let them edit exiting data before passing it back through the Javascript function. Ducktaped and clunky, but at least it lets them get nice looking text on their dashboard.
... View more
01-31-2022
11:59 AM
|
0
|
0
|
587
|
POST
|
thanks @RobertAkroyd1 i recreated the task and it worked twice and failed once and i noticed on my other Notebook thats setup to run every 15 minutes its failed more times than its ran yesterday, in fact its not even tried to run since yesterday afternoon i guess there are some serious issues going on at the moment, maybe its all linked to the other issues i have been having around not being able to export surveys from Survey123, it all seems to have got worse in the last two weeks since the AWS issue thanks again Stu
... View more
12-19-2021
11:49 PM
|
1
|
0
|
575
|
POST
|
The visible column worked for myself, and also agree with Doug Browning re a reassessment being a new form. Good luck.
... View more
11-19-2021
05:12 AM
|
1
|
0
|
312
|
POST
|
@JasonJordan00 I have found the same thing too. See my reply to the post here: https://community.esri.com/
... View more
10-11-2021
11:34 PM
|
0
|
0
|
439
|
POST
|
Maybe this workaround will help... https://support.esri.com/en/technical-article/000024610
... View more
09-24-2021
01:53 PM
|
0
|
0
|
808
|
IDEA
|
Implemented in September 2021 release of Survey123 (version 3.13).
... View more
09-17-2021
07:38 PM
|
0
|
0
|
682
|
POST
|
Hi Phil, I am using the the ID of the published S123 form in AGOL
... View more
08-17-2021
10:21 PM
|
0
|
0
|
1102
|
POST
|
Yes, creating a new map and loading the data layers in again will work. However, without knowing what is causing the issue, making a new map is not a solution as you could be putting in a lot of work into recreating all the customization featured on a map only for the issue to happen again randomly on the new map!
... View more
07-01-2021
11:15 AM
|
0
|
0
|
752
|
POST
|
Jason, it might be struggling with a file that size, but it is just using the regular Export Raster (if you perform Save As). I am at a loss of what might be occurring.
... View more
04-30-2021
10:36 AM
|
0
|
0
|
805
|
POST
|
After upgrading from Pro 2.6.1 to 2.7, Notebooks can no longer connect to our IWA-enabled portal. Previously, this line would be simple enough to connect. gis = GIS('https://portalurl.com/portal') Now, the same line returns an error JSONDecodeError: Expecting value: line 1 column 1 (char 0) I can still connect in Jupyter using v1.6.0 of the API, but now I'm worried if I upgrade to a newer version I'll hit the same issue. Is anyone aware of updates to the API that I might have to account for?
... View more
03-24-2021
07:51 AM
|
0
|
0
|
318
|
POST
|
Using the FeatureLayerCollection method got it to return a token error message that pointed me to a step that slipped my mind. Our portal is behind a firewall so nothing is able to go public, but I forgot to share the layer publicly anyway so it doesn't look for a token (which our authorization methods doesn't easily generate through Python). That's what I've had to do for all other feature services I've used the API on, just plumb forgot to do it this time.
... View more
02-09-2021
11:49 AM
|
1
|
0
|
918
|
POST
|
I shall do so, thank you very much @Anonymous User !
... View more
02-08-2021
12:20 AM
|
0
|
0
|
1649
|
POST
|
Ok, I think I got it work! The mistake was that I did not find the part where to to enable the time setting. Thanks a lot!
... View more
02-06-2021
05:32 AM
|
1
|
0
|
851
|
Title | Kudos | Posted |
---|---|---|
1 | 06-05-2023 03:23 PM | |
1 | 02-03-2022 12:38 PM | |
1 | 07-25-2022 08:29 AM | |
1 | 11-04-2021 05:58 AM | |
1 | 05-03-2021 07:54 AM |
Online Status |
Offline
|
Date Last Visited |
a month ago
|