|
POST
|
How about leaving the fields in but not allowing them to be edited, such as: fieldConfigs: [{
name: "HazardType",
label: "Hazard Type",
editable: false,
direction: "asc"
},
{
name: "descrip",
label: "Description",
editable: false,
direction: "asc"
},
{... There is also a 'showNoValueOption' setting that might work (not much help on it). Or maybe the 'visibilityExpression' that ties to an Arcade expression that is always false? https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureForm-FieldConfig.html#showNoValueOption
... View more
06-07-2021
08:01 AM
|
0
|
1
|
1724
|
|
POST
|
I had an issue with the datetime picker at 4.18 and created a support ticket with Esri. That has been turned into enhancement #ENH-000138560, which is still open. I think this is the same issue that you are having, and if the enhancement is still open (it is) that means it wasn't fixed at 4.19. My application has related tables that I'm using Dojo Dgrid for, which has a datetime picker, but I also utilize the ArcGIS Editor for the primary feature layer, which has the datetime picker problem. In my case, I'm moving forward with what I have with the expectation of updating it once this is fixed. I have spent a little time trying to build one on top of the Editor widget, but I never figured a way to make a custom datetime picker for it. If you figure something out please let me know.
... View more
05-20-2021
09:00 AM
|
1
|
1
|
2177
|
|
POST
|
If you are developing something, you will usually do this on your personal computer using an Integrated Development Environment (IDE) like Visual Studio. Visual Studio does not need IIS installed to run your code, it can use a temporary environment for that. Usually you would only need to use IIS at the server that you will eventually publish your app. If you don't have an IDE yet, Microsoft has a free version of Visual Studio out there. I haven't used it but I know it exists.
... View more
05-13-2021
09:22 AM
|
0
|
0
|
4129
|
|
POST
|
Following Blake's advice, and understanding that you are new to this, copy a one page Esri sample HTML page to the server's C:\inetpub\wwwroot directory. Then you should be able to access it using your server's name and the name of the HTML page as he stated. One example, which is close to the example you want to get to might be: Scenelayerview Query Stats I wouldn't leave things directly in wwwroot as they tend to pile up. My current MO is to put the project in a folder on the another drive and then make a new 'application' in IIS that points to it. My guess is that there's someone else managing your server so this will make a lot more sense to them. Also, this will provide you with an application that's exposed as 'anonymous', meaning anyone can access it. You probably don't want to get into setting anything different in IIS, but if you start adding feature services that aren't shared to the world you will start to see login credentials needed. Just an FYI. Once you have a folder that you can access to put your project file(s) in, you can customize it by going back to the Raluca Nicola example and gathering up the default HTML page and accompanying Javascript files. Put the Javascript files in directory and access them from your HTML page. You might be able to figure out what functonality you want from them and just put it into the single web page example I mentioned above, but that all depends on you. If it was me, at this point, I would start a Visual Studio project for a 1 page HTML app and start to build out the Nicola sample. Then you can upload it to the location you set up for the 1 page test sample and others can see your changes as well (when you publish that is).
... View more
05-12-2021
08:34 AM
|
1
|
1
|
4152
|
|
POST
|
Glad you figured it out. Just one last thing, the 'catch' for the layer.queryFeatures should be: .catch(function (error) {
console.error(outError);
return defLayer.reject(error);
});
... View more
05-11-2021
12:28 PM
|
0
|
0
|
4118
|
|
POST
|
Yeah, sorry, you can't just leave 'All' hanging like that, it's actually another promise so it needs a function for its asynchronous result. I've updated your code below to not error out. I'm not sure how you are trying to access the sketch mode, but at least it won't error out when you run it. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Intro to MapView - Create a 2D map | Sample | ArcGIS API for JavaScript 4.19</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#layerToggle {
top: 20px;
right: 20px;
position: absolute;
z-index: 99;
background-color: white;
border-radius: 8px;
padding: 10px;
opacity: 0.75;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.19/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.19/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/widgets/LayerList",
"esri/widgets/Sketch/SketchViewModel",
"esri/layers/GraphicsLayer",
"esri/geometry/geometryEngineAsync",
"esri/layers/GroupLayer",
"dojo/Deferred",
"dojo/promise/all"
], (
Map,
MapView,
FeatureLayer,
LayerList,
SketchViewModel,
GraphicsLayer,
geometryEngineAsync,
GroupLayer,
Deferred,
all
) => {
const map = new Map({
basemap: "topo-vector"
});
const view = new MapView({
container: "viewDiv",
map: map,
zoom: 12,
center: [-122.228558, 47.303845]
});
//Add Layer
let stormPipes = new FeatureLayer({
url: "https://services9.arcgis.com/jyf59MjuiWfY46oy/arcgis/rest/services/Storm_Pipes/FeatureServer",
id: "Storm Pipes",
title: "Storm Pipes"
});
map.add(stormPipes);
//Add Layer
let stormCatchBasins = new FeatureLayer({
url: "https://services9.arcgis.com/jyf59MjuiWfY46oy/arcgis/rest/services/Storm_Catch_Basins/FeatureServer",
id: "Storm Catch Basins",
title: "Storm Catch Basins"
});
map.add(stormCatchBasins);
let microFilms = [];
//layerList with Legend //
const layerList = new LayerList({
view: view,
listItemCreatedFunction: function (event) {
const item = event.item;
if (item.layer.type != "group") {
item.panel = {
content: "legend",
open: false
};
}
}
});
view.ui.add(layerList, "top-right");
//
/* var stormGroup = new GroupLayer({
title: "Storm",
layers: [stormPipes, stormCatchBasins]
});
map.add(stormGroup);
console.log(stormGroup)
*/
//polgon sketch tool//////////////////////////
polygonGraphicsLayer = new GraphicsLayer({ listMode: "hide" });
map.add(polygonGraphicsLayer);
view.ui.add("select-by-polygon", "top-left");
const selectButton = document.getElementById("select-by-polygon");
selectButton.addEventListener("click", function () {
polygonGraphicsLayer.removeAll();
microFilms = []
view.popup.close();
sketchViewModel.create("rectangle");
});
sketchViewModel = new SketchViewModel({
view: view,
layer: polygonGraphicsLayer,
pointSymbol: {
type: "simple-fill",
color: "yellow",
style: "solid",
outline: {
color: "red",
width: 1
}
}
});
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
sketchViewModel.on("create", async (event) => {
if (event.state === "complete") {
view.map.layers.map(function (lyr) {
if (lyr.visible === true && lyr.type != "graphics" && lyr.type != "group") {
console.log(lyr.title);
}
});
const geometries = polygonGraphicsLayer.graphics.map(function (graphic) {
return graphic.geometry
});
const queryGeometry = await geometryEngineAsync.union(geometries.toArray());
let promises = [];
//let microFilms = [];
function getMicroFilms() {
view.map.layers.forEach((layer) => {
if (layer.visible === true && layer.type != "graphics") {
const query = {
geometry: queryGeometry,
outFields: ["*"]
};
let defLayer = new Deferred;
promises.push(defLayer);
layer.queryFeatures(query)
.then((results) => {
results.features.forEach((feature) => {
if (feature.attributes.MICROFILM != "UNKNOWN") {
microFilms.push(feature.attributes.MICROFILM);
}
});
return defLayer.resolve(results);
})
.catch(function (error) {
console.error(outError);
return defAmenities.reject(error);
});
}
});
all(promises).then(function (results) {
console.log("After all promises are returned");
console.log(results);
console.log(microFilms); //.filter(onlyUnique));
return microFilms;
});
}
console.log(microFilms); //getMicroFilms());
}
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<div id="select-by-polygon"
class="esri-widget esri-widget--button esri-widget esri-interactive"
title="Select features by polygon"> <span class="esri-icon-checkbox-unchecked"></span>
</body>
</html>
... View more
05-11-2021
09:00 AM
|
1
|
2
|
4131
|
|
POST
|
I think Blake's comment is spot on. This is all done using the ArcGIS Javascript API, and going to the link he provided will help. If you open the app in dev tools for the browser, and look at the sources page, you can get access to the primary html page ('index') and the App subdirectory with all of the separate Javascript files used to create it. There'll probably be some images and other things that don't show up there but you can usually find those through URLs. It'll be easier (in my view) than doing it in WAB as you just need to put it all into a folder structure that IIS (or Apache) can access it from. If you have access to a WAB server then you probably also have access to it's IIS, or at leas someone who can install it for you, but to build/customize it you will need to pull in all of those files that I mentioned.
... View more
05-11-2021
07:59 AM
|
2
|
2
|
4180
|
|
POST
|
The layers forEach will cycle through each layer synchronously, but the call to 'queryFeatures' results in an asynchronous promise. Esri has a PromiseAll option that I haven't been able to figure out yet, but I have good results using the Dojo versions. If you add "dojo/Deferred", "dojo/promise/all" to the 'require' statement (and the associated variables), you might try something like this: let promises = [];
let microFilms = [];
function getMicroFilms () {
view.map.layers.forEach((layer) => {
if (layer.visible === true && layer.type != "graphics") {
const query = {
geometry: queryGeometry,
outFields: ["*"]
};
let defLayer = new Deferred;
promises.push(defLayer);
layer.queryFeatures(query)
.then((results) => {
results.features.forEach((feature) => {
if (feature.attributes.MICROFILM != "UNKNOWN") {
microFilms.push(feature.attributes.MICROFILM);
}
});
return defLayer.resolve(results);
})
.catch(function (error) {
console.error(outError);
return defAmenities.reject(error);
});
}
});
all(promises) {
console.log(microFilms.filter(onlyUnique));
return microFilms;
}
} That may work. If not, separate the queryFeatures calls into another function and create the deferred there. Either way the All will only run after all of the separate deferreds have run successfully or failed.
... View more
05-10-2021
03:50 PM
|
1
|
4
|
4146
|
|
POST
|
I'm not familiar with the Portal object. I looked at the 4.18 version and it doesn't have much of an example. It seems you are doing what it says, initially, which is to create the Portal object, setup the query params and then run the query. Not sure where the map is getting set (if at all) in that example. In your code, after you create the Portal object and then set the query params and run the query, you then set up the Map and MapView. Nowhere do I see the creation of a Featurelayer or other object that you can add to the Map to create a layer. If the portal id that you obfuscated is supposed to be a Map with a Layer in it then I don't see a need to then create the Map and MapView. Not sure if I can help you here, but to my previous points, there are 2 'portal.load' events that you should try to combine into 1 to see if that helps. And the 'addLayer' functions are just that, functions that need to be called, not events. If you are trying to get a reference to when the layer gets added, you may try something like: // This function fires each time a layer view is created for a layer in
// the map of the view.
view.on("layerview-create", function(event) {
// The event contains the layer and its layer view that has just been
// created. Here we check for the creation of a layer view for a layer with
// a specific id, and log the layer view
if (event.layer.id === "satellite") {
// The LayerView for the desired layer
console.log(event.layerView);
}
}); But I don't really see anywhere that a layer is being added. If the item being reference is a layer, you might try getting it as a PortalItem and then adding it to the map, as in: // to access the portal item at this url
// http://www.arcgis.com/home/item.html?id=d7892b3c13b44391992ecd42bfa92d01
var item = new PortalItem({
id: "d7892b3c13b44391992ecd42bfa92d01"
});
if (item.isLayer) {
Layer.fromPortalItem({
portalItem: item
}).then(addLayerToMap);
} Sorry I can't help further.
... View more
04-13-2021
03:22 PM
|
0
|
1
|
2487
|
|
POST
|
Well, you also have 3 'addLayer' functions, 2 existing under the 'createGallery' function, and 1 existing at the main script level. But there's nothing calling an 'addLayer' function, nor is there anything in any of the 'addLayer' functions that's actually performing an addlayer on the map, just console.log references.
... View more
04-13-2021
02:35 PM
|
0
|
1
|
2499
|
|
POST
|
The only place I see 'initialState' being used in the fieldConfig is identified under FieldGroupConfig and InfoFieldGroup, both of which identify the setting as "colllapsed". I added both of those classes and set my initialState to "collapsed" and it didn't work either. I think this is a bug and you should follow up with a ticket with Esri as I would sure like to have that functionality work.
... View more
04-06-2021
03:56 PM
|
0
|
0
|
757
|
|
POST
|
Not sure if you are going for being logged in before accessing the data or not, but if you just put your Organization level layer into one of the samples (such as https://developers.arcgis.com/javascript/latest/sample-code/intro-mapview/ ) then it should ask you for credentials on load. I'm doing something similar right now and then need to figure out who logged in which is done using the "esri/idenity/IdentityManager" class (and the "dojo/on" class). That would look something like: esriId.on("credential-create", function(e) {
console.log(e.credential.userId);
});
... View more
04-06-2021
11:57 AM
|
0
|
0
|
4612
|
|
POST
|
Some of the Esri samples strive to show us one thing, but obfuscate what else is happening. In this case, I think the highlighting is done through the MapView class. If you set 'highlightOptions' on load then any click event will use that to highlight the selected graphic. The 'listNode.addEventListener("click", onListClickHandler)' declaration is handling the click event for the right side click, but I think the MapView is by default handling the map click event, which then triggers the MapView update which then uses the current 'highlightOptions' to draw the selection. If you look at the bottom of the Mapview class it specifies inherited events. You can attach to these to get access to the click (and the selected graphics) if needed, but if you just want to modify how the highlight looks then I would look at the 'highlightOptions'.
... View more
04-05-2021
08:56 AM
|
1
|
0
|
1318
|
|
POST
|
You needed another parenthesis, or right round bracket before the catch, to finish off the 'then' function from the query. My guess is that you added one at the end of the catch to make it compile, but that should only be 1 right parenthesis, round bracket. Try this: queryTask.execute(query).then(function(results){
var feat = results.features[0];
provinces = feat.attributes.PROVINCE;
wards = feat.attributes.WARD_NO;
districts = feat.attributes.DCS12_NAME;
municipalities = feat.attributes.S12_NAME
showWards.push(wards);
var xwards = showWards.toString();
console.log(provinces);
console.log(wards);
console.log(districts);
console.log(municipalities);
console.log(xwards);
//Call to CRM to populate the lookup field for Province
debugger;
window.parent.Xrm.WebApi.online.retrieveMultipleRecords("dea_province", "?$select=dea_name,dea_provinceid&$filter=dea_name eq '" + provinces + "'").then(
function success(results) {
debugger;
for (var i = 0; i < results.entities.length; i++) {
var dea_name = results.entities[i]["dea_name"];
var dea_provinceid = results.entities[i]["dea_provinceid"];
//Populate lookup
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = dea_provinceid; // GUID of the lookup id
lookupValue[0].name = dea_name; // Name of the lookup
lookupValue[0].entityType = "dea_province"; //Entity Type of the lookup entity
window.parent.Xrm.Page.getAttribute("dea_province").setValue(lookupValue);
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
//Call to CRM to populate the lookup field for the Local Municipality
window.parent.Xrm.WebApi.online.retrieveMultipleRecords("dea_localmunicipality", "?$select=dea_localmunicipalityid,dea_name&$filter=dea_name eq '" + municipalities + "'").then(
function success(results) {
for (var i = 0; i < results.entities.length; i++) {
var dea_localmunicipalityid = results.entities[i]["dea_localmunicipalityid"];
var dea_name = results.entities[i]["dea_name"];
//Populate lookup
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = dea_localmunicipalityid; // GUID of the lookup id
lookupValue[0].name = dea_name; // Name of the lookup
lookupValue[0].entityType = "dea_localmunicipality"; //Entity Type of the lookup entity
window.parent.Xrm.Page.getAttribute("dea_localmunicipality").setValue(lookupValue);
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
//Call to CRM to populate the lookup field for District Municipality
window.parent.Xrm.WebApi.online.retrieveMultipleRecords("dea_districtmunicipality", "?$select=dea_districtmunicipalityid,dea_name&$filter=dea_name eq '" + districts + "'").then(
function success(results) {
for (var i = 0; i < results.entities.length; i++) {
var dea_districtmunicipalityid = results.entities[i]["dea_districtmunicipalityid"];
var dea_name = results.entities[i]["dea_name"];
//Populate lookup
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = dea_districtmunicipalityid; // GUID of the lookup id
lookupValue[0].name = dea_name; // Name of the lookup
lookupValue[0].entityType = "dea_districtmunicipality"; //Entity Type of the lookup entity
window.parent.Xrm.Page.getAttribute("dea_districtmunicipality").setValue(lookupValue);
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
//Populate the coordinates field
debugger;
window.parent.Xrm.Page.getAttribute("dea_latitude").setValue(latlon);
window.parent.Xrm.Page.getAttribute("dea_longitude").setValue(latlon);
window.parent.Xrm.Page.getAttribute("dea_ward").setValue(xwards);
//THE END OF CALLS TO CRM
})
.catch(function (error) {
console.error("Query Error: " + error);
});
... View more
03-29-2021
08:10 PM
|
1
|
1
|
2345
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-01-2022 02:02 PM | |
| 1 | 02-28-2024 01:40 PM | |
| 2 | 02-27-2024 01:13 PM | |
| 1 | 10-18-2022 11:31 AM | |
| 1 | 06-23-2023 09:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-28-2025
09:15 AM
|