|
POST
|
You are right, getFolders() doesn't return the root folder. You can fetch the root folder by using the URL directly. For example, the following code snippet shows how to add an item to the root folder.
var userContentUrl = user.portal.url + "/content/users/" + user.credential.userId,
folderUrl;
if ("Want to save to the root folder") {
folderUrl = userContentUrl;
} else {
folderUrl = userContentUrl + "/" + folderId;
}
var request = esri.request({
url: folderUrl + "/addItem",
content: item
}, {
usePost: true
});
request.then(requestSucceeded);
... View more
11-22-2013
04:30 PM
|
0
|
0
|
365
|
|
POST
|
When you say "add to map", is that map only for you displaying on your computer? Or, do you want to pass the URL of the web app so that you can share it? In order to share your data or layer, you have to host it as a service either on your ArcGIS Server machine, or put it on arcgis.com.
... View more
11-22-2013
04:21 PM
|
0
|
0
|
979
|
|
POST
|
If you need to wait for both queryComplete and mapOnload finish to call initEditor(), deferredList is what you are looking for. http://livedocs.dojotoolkit.org/dojo/DeferredList
... View more
11-22-2013
04:19 PM
|
0
|
0
|
1203
|
|
POST
|
Jason, Please take a look at the code snippet.
function updateWebMap() {
var portal = new esri.arcgis.Portal("http://www.arcgis.com/sharing/rest");
portal.signIn().then(getItem);
};
function getItem(user) {
var itemUrl = user.portal.url + "/content/items/" + webMapId;
var request = esri.request({
url: itemUrl,
content: {
"f": "json"
}
});
request.then(dojo.partial(getWebMapText, user, itemUrl));
};
function getWebMapText(user, itemUrl, item) {
if (item.type === "Web Map") {
//get current webmap text
var request = esri.request({
url: itemUrl + "/data",
content: {
"f": "json"
}
});
request.then(dojo.partial(updateWebMapText, item, user));
} else {
alert("Not a Webmap item!");
}
};
function updateWebMapText(item, user) {
var folder = (item.ownerFolder) ? "/" + item.ownerFolder : "";
var userItemUrl = user.userContentUrl + folder + "/items/" + item.id;
var webMapText = dojo.toJson(webMapJson);//your updated web map
var contentUpdate = {
"text": webMapText,
"f": "json"
};
var request = esri.request({
url: userItemUrl + "/update",
content: contentUpdate
}, {
usePost: true
});
request.then(requestSucceeded);
//console.log(userItemUrl);
};
Hi Kelly, I don't see a REST operation that can be used to update the item data. Can you point out which operation is for editing and updating the item data? Thanks, Jason
... View more
11-22-2013
02:18 PM
|
0
|
0
|
930
|
|
POST
|
This should be caused by missing CSS. Please check if you have all the neccessary CSS files imported.
... View more
11-22-2013
01:37 PM
|
0
|
0
|
1196
|
|
POST
|
Posting it 3 times really makes it urgent. 🙂 After the call to generateRenderer completes, you get the renderer and you can manipulate it before applying it to the layer. Here is a code snippet. It's probably more than you asked. You can ignore minValue and maxValue for your case. Hope this helps.
function _processRenderer(renderer, prefix, unitLabel, formatLabel, precision, minValue, maxValue){
if (renderer.declaredClass === "esri.renderer.ClassBreaksRenderer") {
array.forEach(renderer.infos, function (item, idx) {
if (idx === 0 && minValue !== undefined && minValue !== null) {
item.minValue = minValue;
}
if (idx === renderer.infos.length - 1 && maxValue !== undefined && maxValue !== null) {
item.classMaxValue = item.maxValue = maxValue;
}
if (precision) {
item.classMaxValue = item.maxValue = Math.round(item.maxValue / precision) * precision;
item.minValue = Math.round(item.minValue / precision) * precision;
}
if (formatLabel) {
item.label = number.format(item.minValue) + " - " + number.format(item.maxValue);
}
if (prefix) {
item.label = prefix + " " + item.label;
}
if (unitLabel) {
item.label = item.label + " " + unitLabel;
}
});
}
else {
array.forEach(renderer.infos, function (item, idx) {
if (idx === 0 && minValue !== undefined && minValue !== null) {
item.value = minValue;
}
if (idx === renderer.infos.length - 1 && maxValue !== undefined && maxValue !== null) {
item.value = maxValue;
}
if (formatLabel) {
item.label = number.format(item.value);
}
if (prefix) {
item.label = prefix + " " + item.label;
}
if (unitLabel) {
item.label = item.label + " " + unitLabel;
}
});
}
return renderer;
}
... View more
09-13-2013
11:11 AM
|
0
|
0
|
919
|
|
POST
|
Since it works fine in HTML, it's reasonable to assume that something is wrong in the translation from JSPX to HTML. I'm afraid that it's out of scope of Esri JavaScript API team. Maybe you share reproducible steps so that we may be able to help?
... View more
09-06-2013
05:52 PM
|
0
|
0
|
1329
|
|
POST
|
Measurement widget already has �??Nautical Miles�?� built in. We just didn�??t expose it. In order to show it on the drop down menu, you just need to add a menu item. And the widget will handle all the conversions and book keeping work. Here is the code snippet:
dojo.connect(measurement.distance, "onClick", function(){
if (this.checked) {
var nauticalMenuItem = new dijit.MenuItem({
label: "Nautical Miles",
onClick: function(){
measurement._switchUnit("Nautical Miles");
}
});
measurement.unit.dropDown.addChild(nauticalMenuItem);
}
});
That�??s all the code you need for distance measurement. In case you need the area measurement tool work with nautical miles as well, here is the code:
//from acres to square nautical miles
measurement.unitDictionary["Square Nautical Miles"] = 0.001179874545293396;
dojo.connect(measurement.area, "onClick", function(){
if (this.checked) {
var nauticalAreaMenuItem = new dijit.MenuItem({
label: "Square Nautical Miles",
onClick: function(){
measurement._switchUnit("Square Nautical Miles");
}
});
measurement.unit.dropDown.addChild(nauticalAreaMenuItem);
}
});
... View more
07-29-2013
03:46 PM
|
0
|
0
|
712
|
|
POST
|
Over the years, there were quite many questions regarding the proxy page. Here I'm trying to explain the detailed information about use cases of proxy page. Hopefully this will clear up all proxy page related mysteries. The general rule regarding when proxy page is required is this: when cross domain requests are required, always configure a proxy page for the application. The ArcGIS API for JavaScript is smart enough to determine when to use it. The same origin policy is a security concept, which restricts requests made by an application to the host domain of the application. For example, if the web application is hosted on www.xyz.com, when there is any request to any domain that is not xyz.com, it is not allowed. There are exceptions to this policy: CSS, images and JavaScript loaded through link, img and script tags, respectively, are allowed to make cross domain requests. For more detailed info, refer to the following: same origin policy on Wikipedia (http://en.wikipedia.org/wiki/Same_origin_policy) same origin policy on the Mozilla Developer Network(MDN) (https://developer.mozilla.org/en-US/...for_JavaScript). Below is a detailed list of common scenarios that require cross domain requests. In each case, an explanation is provided describing whether or not a proxy page will be used. In all cases, a proxy should be set up so that an application can use it if necessary. 1. If the services support CORS, (all 10.1 ArcGIS Server service should support CORS), and at the same time, if the browsers support CORS as well, it doesn�??t need proxy. Here is an example. http://developers.arcgis.com/en/javascript/samples/widget_print/ If using Firefox or Chrome, this application sends the print request without using the proxy page. But IEs don�??t support CORS fully, as application developers, it�??s always safe to put proxy page to satisfy all browsers. 2. Even without CORS support, for instances, ArcGIS Server 10 services don�??t support CORS, since the services support JSONP, only when the request is through POST, it needs proxy page. a. The request is through GET, proxy is not necessary. An example http://developers.arcgis.com/en/javascript/samples/query_nomap/ By examing the request, the query is going through an HTTP GET through a URL, you can see the response has a jsonpCallback attached to the returned json, which eliminates the usage of proxy page. b. The request is through POST, because the request is large enough to exceed 2000 characters. For example: http://developers.arcgis.com/en/javascript/samples/query_buffer/ This is a perfect example. You can see there are two requests. The first one is a call to a GP service to perform a buffer calculation, which is through GET, so that it doesn't use proxy. While the second request to query features within the bufferred area, it needs to include the geometry of the buffer in the request, which is too big to use GET, so that a POST is sent through proxy. c. The request is through POST, because the request is required to be POST by server, such as editing cases where POST is mandatory. http://developers.arcgis.com/en/javascript/samples/ed_simpletoolbar/ For case 2.b and 2.c, the response doesn�??t have the callback parameter attached ahead of the json. In short, when JSONP + GET, proxy page is not needed. When JSONP + POST, proxy page is necessary. 3. If the response is other formats than JSONP, proxy page is always needed. An example is when loading WMTS layer, the first request is to get the capabilities XML, since the format is not JSONP, it always has to go through a proxy page to get the XML. http://developers.arcgis.com/en/javascript/samples/layers_wmtslayer/ You can see that the capabilities XML is got through a proxy page. (even though the sample doesn't work at this moment due to the service is down, you can still see the request through proxy). 4. When uploading files, some browsers (of course, IE) don�??t support the native uploading method, so it is always required to have a proxy page in between so that iframe can do the job of uploading. http://developers.arcgis.com/en/javascript/samples/ed_attachments/ 5. When generating a token through a token service, since neither ArcGIS Server 10 nor ArcGIS Server 10.1 token service support CORS, proxy page is always needed. An example is when use identity manager. 6. It is possible to force to use proxy page all the time by setting esri.config.defaults.io.alwaysUseProxy = true. For some cases, the services may be behind fire wall or other security settings, proxy is always necessary. All of the above use cases are under the assumption that there are cross domain requests. If all the requests are to the same domain as the application, it never needs proxy page. Even putting a proxy page there, it won�??t use it. For example: https://servicesbeta.esri.com/demos/...tymanager.html The app is the same domain as the token service, so it ignores the proxy page setting and get the token directly.
... View more
07-15-2013
11:33 AM
|
3
|
2
|
7032
|
|
POST
|
Please take a look: https://developers.arcgis.com/en/javascript/jshelp/ags_proxy.html
... View more
06-28-2013
12:28 PM
|
0
|
0
|
759
|
|
POST
|
Please put a proxy page in your code. If you are not sure when proxy page is needed, just put it there and it won't hurt anything. most cases, you will run into situations where proxy is required. Your second question is not related to CORS.
... View more
06-28-2013
12:02 PM
|
0
|
0
|
759
|
|
POST
|
It will support it in the next release. It will allow you to go to higher levels where there are no data available. Please note, you also need tiled map service on arcgis server 10.2 in order to do this. Is there a way in the Javscript API to zoom in beyond the cached levels, but still show the cache?
... View more
06-24-2013
02:37 PM
|
0
|
0
|
509
|
|
POST
|
This is a service side bug. Luckily we have a workaround on client. If you are using printTask, just simply attach a time stamp at the end of the result url. If you are using printDijit, please try the code
dojo.connect(printer, "onPrintComplete", function(result){
var currentTime = new Date();
result.url += "?ts="+currentTime.getTime();
});
... View more
06-21-2013
01:17 PM
|
2
|
0
|
1267
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 06-21-2013 01:17 PM | |
| 3 | 07-15-2013 11:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|