|
POST
|
Update for anyone struggling similarly to me, I got that method working: watchUtils.on(graphicsLayer, "graphics", "change", function (evt) { The reason it wasn't working was that I had graphics being added/created via app.MapView.graphics instead of the graphicsLayer. They are two separate containers! So the watch was working, but not detecting anything because I was adding graphics to the "wrong" place. Making sure each graphic creation took place within graphicsLayer did the trick. Of course, now I'm struggling to make sure I can detect creation of graphics from several methods. Search result graphics appear to be created in the app.MapView by default...I can override that, but then I need to customize each type. And it appears that featureLayer sources create additional graphics (probably in the app.MapView!) that I can't detect/clear!
... View more
05-28-2021
09:24 AM
|
0
|
0
|
4073
|
|
POST
|
Dang. I don't remember what happened when I tried it in my code, which is a spaghetti mess of course. But I just tried it in the SketchWidget sample (clicking to create graphics is more like my use case) and it worked fine. watchUtils.on(graphicsLayer,"graphics","change",function(){ console.log("Graphics Changed!"); }); At least this confirms for me that I was on the right track with that methodology...now I just have to debug why it failed with my code at the time. Thanks!
... View more
05-27-2021
12:16 PM
|
0
|
1
|
4088
|
|
POST
|
Anyone successfully set up a watch event (using watchUtils or some other kind of listener) on changes in the Graphics Layer? I got what I wanted working by watching the mapView for "updating" (code below) but that seems overkill because it fires with every map event, even ones that have nothing to do with graphics. I tried the following but it doesn't work: watchUtils.on(graphicsLayer,"graphics","change",function(){ ... }); ...and watchUtils.when(graphicsLayer.... only fired once, when the layer was added. Here's what worked, just curious if it can be optimized/improved: //Watch the app.MapView for the updating property to assess graphics situation. watchUtils.watch(app.mapView,"updating",function(){ //console.log("map updating."); if (this.graphics.items.length > 0) { ...code block to execute } });
... View more
05-27-2021
10:19 AM
|
0
|
3
|
4132
|
|
POST
|
I'm researching the same thing today. Haven't figured it out yet but hopefully will post here if I do. Trying to work off: JSAPI sample (more complicated than I need): Reference Arcade expressions in PopupTemplate | ArcGIS API for JavaScript 4.16 AGOL blog: https://community.esri.com/community/gis/web-gis/arcgisonline/blog/2017/07/18/conditional-field-display-with-arcade-in-pop-ups GeoNet question: https://community.esri.com/thread/233503-can-i-eliminate-empty-values-using-arcade-in-my-pop-up Some of the comments after the AGOL blog are leading in me in good directions but not quite there. Have you figured it out yet?
... View more
08-26-2020
11:39 AM
|
0
|
1
|
3657
|
|
POST
|
Here's the entire script for anyone interested - obviously it's called by another script so a bunch of the specifics are refactored out. Hope it's useful. /*Paginated table builder via datatables.net HAS: configured URL against the overlay layer, 1=1 where clause, specific out fields initial loading gif to accompany "Processing...", which doesn't really cover the initial load */ function loadtable(overlayLayerUrl,lyrOutFields,sortableFields,sortColumn,displayStart,pageLength,totalOverlayFeatureCount){ var colArr = lyrOutFields.split(','); //pull the individual columns out of the lyrOutFields to build a custom column object var columnsObj = []; $(colArr).each(function(i){ if ($.inArray(colArr[i],sortableFields) !== -1) { columnsObj.push({ 'data': 'attributes.'+colArr[i],'orderable':true }); //set the column to sortable } else { columnsObj.push({ 'data': 'attributes.'+colArr[i],'orderable':false }); //set the column to unsortable } }); //build the AJAX URL - could probably get by with less params var tableURL = overlayLayerUrl+"/query?where=1%3D1&text=&objectIds=&time=&geometry="; tableURL += "&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam="; tableURL += "&returnGeometry=false&returnTrueCurves=false&maxAllowableOffset=&outFields="+lyrOutFields; tableURL += "&geometryPrecision=&outSR=&having=&returnIdsOnly=false" tableURL += "&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&historicMoment="; tableURL += "&returnDistinctValues=false&queryByDistance=&returnExtentOnly=false"; tableURL += "&datumTransformation=¶meterValues=&rangeValues=&quantizationParameters=&featureEncoding="; tableURL += "esriDefault&f=json"; $('#tableSpace').DataTable({ destroy: true, // delete and recreate table for sorting purposes order: sortColumn, //initial sort column searching: false, serverSide: true, //false would allow for nice native sorting but limited to the REST endpoint's default record count processing: true, displayStart: displayStart, // set the page the user is on pageLength: pageLength, // set how many records to show ajax: { url: tableURL, type: 'get', format: 'json', dataSrc: function(json) { // grabbing the data we want to display, also setting some params datatables uses for pagination json.recordsTotal = totalOverlayFeatureCount; //set from the initial AJAX request for queryFeatureCount json.recordsFiltered = totalOverlayFeatureCount; return json.features; }, data: function(d) { // this is where datatables add url params for server-side processing d.resultOffset = d.start; d.resultRecordCount = d.length; //reference the request against the column array to customize the sort d.orderByFields = colArr[d.order[0].column] +" "+ d.order[0].dir; return d; } }, columns: columnsObj, initComplete: function(settings, json) { //show HTML content after load $("#tableSpace").css("display","block"); $('#tableThrobber').hide(); //make the page length drop down more compliant with WCAG for select //take the select element and place it after the label element $('#tableSpace_length').find('select').each(function () { $(this).parent().after(this); $(this).attr('id', 'datatable_lengthSelect'); }); //change the HTML of the label to be more compliant $('#tableSpace_length').children('label').html("Select number of records per page: ") $('#tableSpace_length').children('label').attr('for','datatable_lengthSelect') } });//end datatables function }
... View more
03-09-2020
11:03 AM
|
1
|
0
|
717
|
|
POST
|
I figured it out! Pretty much already had it in my code - referencing the request itself is pretty easy inside the "data" function. In this way, the original sort order can be set, AND the user can then sort themselves, but it still works with server-side functioning and more than 1,000 rows (which I had previously taken care of by the dataSrc function). I already had the first two lines, just added the d.orderByFields line: data: function(d) { // this is where datatables add url params for server-side processing d.resultOffset = d.start; d.resultRecordCount = d.length; //reference the request against the column array to customize the sort d.orderByFields = colArr[d.order[0].column] +" "+ d.order[0].dir; return d; }
... View more
03-09-2020
10:54 AM
|
0
|
1
|
5095
|
|
POST
|
Yeah, I originally specified the ordering in the REST query but didn't like having to then mess with the native styles. Sorry I edited my original before seeing your response...if I do client-side, I am limited to the 1,000 features returned by the server. So yes, I'm trying to do that concatenation you mention, but I don't know how to "snoop" on the order requested by the user when creating that concatenation. I'm searching for examples of where the DataTables request can be self-referenced.
... View more
03-09-2020
10:34 AM
|
0
|
2
|
5095
|
|
POST
|
William, this is a great example. I'm currently struggling with getting DataTables to alter the AJAX request for sorting when my REST endpoint expects "orderByFields = <FIELD><ASC/DESC>", and DataTables just sends the two "order" params defined at https://datatables.net/manual/server-side If I could somehow self-reference those options in the "data" function, I could customize the request and make it work. But your example makes me think you got it working WITHOUT customization. Maybe that's because you're not using the serverSide option and have less than the typical Esri REST-endpoint limit of 1,000 rows. Could you confirm that's true? Thanks --mike
... View more
03-09-2020
10:01 AM
|
0
|
4
|
5094
|
|
POST
|
Did you ever figure this out? I am working with 4.14 and the first time after a search the popup appears with no content. The second time through it works as expected.
... View more
02-12-2020
11:20 AM
|
0
|
0
|
1063
|
|
POST
|
Super cool. I logged in just to come here and say "thanks" for this solution - while I actually couldn't get it working I think I was only about a few steps away from getting it there. Since I created my popup at the same time as the MapView, I don't think the variable was quite right. BUT it led me to look at the Property Overview: Popup | ArcGIS API for JavaScript 4.14 And from there I saw that I could set collapseEnabled: false, on the popup during construction, and achieve the same end result! Cheers, mike
... View more
02-05-2020
01:39 PM
|
2
|
0
|
2742
|
|
POST
|
Jeez, found them. WHY does it always take ten (Google) searches to find stuff like this? Service output—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers
... View more
02-16-2018
10:10 AM
|
5
|
0
|
6611
|
|
POST
|
Yeah, none of the docs above are what I'm looking for, either. It's pretty easy to force a bad token so I know at least one error code out of the REST API: {"error":{"code":498,"message":"Invalid Token","details":[]}} but...seriously, there's no others? Pretty sure a timeout can happen too. Gotta be a list somewhere.
... View more
02-16-2018
10:08 AM
|
0
|
2
|
6611
|
|
POST
|
Awesome! Just the answer I needed, thanks for posting this!!!
... View more
02-09-2018
09:55 AM
|
0
|
0
|
2933
|
|
POST
|
OK, here's what I had to do to fix this issue - hopefully you have your locator source data to do the same. First, check to see if your locator source data (ie addressable streets, address points, parcels, etc) are stored with Z and M coordinates. If they are, get rid of those geometry elements by exporting from one feature class to another, but disabling Z and M values in your Geoprocessing Environment variables. Then, rebuild your locators on the new source data. After doing that, I was able to geocode against my new locators and the outputs are just points - which work everywhere more consistently!
... View more
06-07-2016
01:41 PM
|
1
|
3
|
1682
|
|
POST
|
I'm pretty much having this exact same problem. It may be something going on with 10.4, since I recently upgraded, and didn't have this problem before. I also thought of the Geoprocessing environment settings - and my change made no difference, just as you found. Regarding your aside question, the only way I can think of that happening is if it were also tied with another candidate, and you chose NOT to match if candidates were tied.
... View more
05-31-2016
10:08 AM
|
1
|
1
|
1682
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 11-01-2024 10:29 AM | |
| 1 | 03-29-2022 11:27 AM | |
| 8 | 12-15-2023 07:34 AM | |
| 1 | 06-13-2023 12:47 PM | |
| 1 | 03-09-2020 11:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-09-2025
12:50 PM
|