POST
|
Works fine if you pass an element like so: // rest of your code above
//Check is the layer is queryable
if (restService.label.includes("*")) {
disLayer = new FeatureLayer({
title: restService.label,
url: restService.restServiceLink,
outFields: ["*"], // Return all fields so it can be queried client-side
popupTemplate: { // Enable a popup
title: "<b>" + restService.label + ": {" + restService.searchAndPopupFieldName + "} </b>",
content: setContentInfo
}
});
}
function setContentInfo() {
let div = document.createElement("div");
div.innerHTML = "test test test";
return div;
}
... View more
10-17-2021
12:11 PM
|
2
|
0
|
771
|
POST
|
Yeah, @BenRomlein, I saw those too, those were the 4.4 API results I was seeing. I too have the developers site bookmarked, but am truly a lazy developer that only ever opens new browser tabs and starts typing 😉. For the most part, I just use the links VS Code will provide in the hints when hovering over an ArcGIS JS API class but if I haven't added the import statement yet and not really sure where I am going (like the changes with print/print template/etc. from 4.19 to 4.20) I still end up using the Google. In any case, @AndyGup et al are on the case, satisfied that someday my lazy workflow will again be acceptable.
... View more
08-27-2021
09:30 AM
|
0
|
0
|
986
|
POST
|
For the past few days every search I perform using Google is only returning 3.37 results, with an odd 4.4 result but none with the latest API. Tried on Chrome on PC and Mac, and Safari on Mac, incognito/private browsing for both and the same results. Just some of the Google searches used: arcgis javascript api feature layer, arcgis javascript api featurelayer, arcgis js api popup I know all the docs are still online and can easily get to the developers page, but found this strange enough to throw it out to the community. Anyone else experiencing this and a bit annoyed?
... View more
08-27-2021
09:16 AM
|
0
|
4
|
1008
|
POST
|
Kevin MacLeod I think the issue you're experiencing is due to wrong paths in your import statements; the dojo-typings should just contain the classes for typescript not the actual JavaScript modules. The 4.x API is a bit different than the 3.x and a lot of things you would have used dojo's "on" for already have built in on methods in 4.x.
... View more
07-29-2020
06:55 AM
|
0
|
1
|
1944
|
POST
|
Edited: for those of us uninitiated in typescript, what divya bathina is describing is using a triple slash directive. Putting this directive at the top of a .ts file helps the tsc figure out where to look for the typings.
... View more
07-27-2020
08:59 AM
|
1
|
3
|
1944
|
POST
|
I ended up using the REST API's appyEdits method. I had to loop through the form, get the files from the input (user could upload more than one image), upload the images to the service and get back the upload id's, then do the post using applyEdits with the attachments in the callback from the upload posts. The docs say that base64 strings will work too, but I hacked away at that for hours before giving up and using the upload method Here's my function for getting the files from a form: function getTheFiles() {
var filesArr = [];
var inputForms = attachmentsNode.querySelectorAll("form");
for(var i = 0; i < inputForms.length; i++) {
var input = inputForms[i].querySelectorAll("input[type=file]");
if(input[0].files.length > 0) {
filesArr.push(input[0].files[0])
}
}
return filesArr;
} And here's the upload: function uploadFilesFunction(filesArr, config, callback){
uploadItems = [];
if(filesArr.length > 0){
var counter = 0;
filesArr.forEach(function(file, filesIndex) {
var uploadFormData = new FormData(); // add key value pairs for the request to this object
var xhr = new XMLHttpRequest();
var baseEditUrl = config.serviceUrls.edit.substring(0, config.serviceUrls.edit.length -2);
var uploadUrl = baseEditUrl + "/uploads/upload";
xhr.open("POST", uploadUrl);
xhr.onerror = function(err){
console.error("this is the error handler from xhr for file upload", err);
resetMainControls();
hideLoadingDiv();
showMessages(errorReportMessage, false);
};
var fileType = filesArr[filesIndex].type;
xhr.onreadystatechange = function(evt) { // Call a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
var response = JSON.parse(xhr.response);
if (response.hasOwnProperty("success")) {
if (response.success){
uploadItems.push({
"globalId": uuidv4(),
"parentGlobalId": parentGlobalId,
"contentType": fileType,
"name": response.item.itemName,
"uploadId": response.item.itemID
});
counter += 1;
if(callback){
if(counter == filesArr.length){
callback(uploadItems, config);
}
}
}
} else {
console.log("item didn't upload");
console.log(response);
}
}
}
uploadFormData.append("f", "json");
uploadFormData.append("file", filesArr[filesIndex]);
// counter += 1;
xhr.send(uploadFormData);
});
} else {
callback(uploadItems, config)
}
}
// second function to call when first function resolves:
function doThePostPart(uploadItems, config){
console.log("doThePostPart started")
var feature = {
"geometry": graphic.geometry,
"attributes": graphic.attributes
};
var applyEditsFormData = new FormData();
applyEditsFormData.append("f","json");
applyEditsFormData.append("useGlobalIds", true);
applyEditsFormData.append("adds",JSON.stringify([feature]));
applyEditsFormData.append("attachments",JSON.stringify({"adds":uploadItems}));
var xhrApplyEdits = new XMLHttpRequest();
xhrApplyEdits.open("POST", config.serviceUrls.edit + "/applyEdits");
xhrApplyEdits.onreadystatechange = function(response) { // Call a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
resetMainControls();
hideLoadingDiv();
showMessages(reportMessage, false);
}
};
xhrApplyEdits.onerror = function(err){
console.error("this is the error handler from xhrApplyEdits", err);
resetMainControls();
hideLoadingDiv();
showMessages(errorReportMessage, false);
};
xhrApplyEdits.send(applyEditsFormData);
}
var theFiles = getTheFiles();
uploadFilesFunction(theFiles, this.config, doThePostPart) // call to start the chain Hope this helps if anyone out there is in the same predicament, and thanks Dom for reminding me to share when we find working solutions .
... View more
09-09-2019
04:28 PM
|
2
|
5
|
4635
|
POST
|
462 Views of a two year old post and no replies? Come on Esri staff, break away from the UC for a minute and at least take a stab at it!
... View more
07-09-2019
09:58 AM
|
4
|
0
|
4635
|
POST
|
Thanks John! It was the iCloud photo library. Very much appreciated, Ryan
... View more
04-24-2018
06:53 AM
|
1
|
0
|
581
|
POST
|
I am testing Spike integration with Survey123 and the data is not being passed into the form. I've tried the sample Spike form, and a custom single question form, and both result in the same problem. The error code changes but is a similar every time: Some additional info: Survey123 version 2.7.98, Connect version 2.6.6, brand new spike for tablets and an iPad Mini 4 Cellular+Wifi. Any ideas why this isn't working?
... View more
04-23-2018
01:57 PM
|
0
|
2
|
693
|
IDEA
|
I really love the pages in Survey123, and in one of my surveys, I have a couple of images on a page that function as a field identification guide. It would be useful to be able to provide a link that jumps to that page from other places in the survey, and I believe there are other use cases that would support this kind of functionality (like a table of contents).
... View more
09-29-2017
07:33 AM
|
3
|
2
|
412
|
Title | Kudos | Posted |
---|---|---|
2 | 10-17-2021 12:11 PM | |
1 | 07-27-2020 08:59 AM | |
2 | 09-09-2019 04:28 PM | |
4 | 07-09-2019 09:58 AM | |
3 | 09-29-2017 07:33 AM |
Online Status |
Offline
|
Date Last Visited |
10-27-2023
02:24 PM
|