POST
|
Thank you Noah! That was in fact the problem. I had been firing the query after the map.on("layers-add-result") event, and had forgotten that I moved the query outside of this event when I was debugging another error. It is working fine now.
... View more
06-09-2014
06:19 AM
|
0
|
0
|
236
|
POST
|
I recently updated my application to JSAPI 3.9 and I noticed that the queryFeatures method on Feature Layers is not working as expected. It will not return all feature attributes and does not honor the 'outFields' property for the Feature Layer or for the query. The only attribute field that is returned is the one set as the display field. I am able to work around this by using a Query Task, which returns the attribute fields as set in the Feature Layer outFields property. I was able to use the queryFeatures method prior to switching to version 3.9, so I suspect this is a bug. Has anyone else has encountered this issue?
... View more
06-02-2014
06:50 AM
|
0
|
2
|
917
|
POST
|
I've built a customized legend widget for the Javascript API that I'd like to share with the user community. I can't find the old Code Gallery on the ArcGIS site anymore so I'll just post it here. If anyone knows of a better place to share it please let me know. I realize there are a couple of other customized legend widgets available, but I was never completely satisfied with any of them so I built my own. It was actually quite a bit simpler to create a widget that worked for our in-house apps than it was to build a more robust version that could serve the larger community, but I was motivated by the challenge and wanted to hone my skills. I'm really happy with it, I hope others find it useful as well. You can view and download the code for the widget on GitHub: https://github.com/ReneeMaxwell/TOCLegendWidget Enjoy!
... View more
12-20-2013
08:44 AM
|
0
|
2
|
1348
|
POST
|
You will need to reconfigure your code to incorporate part of the code I originally posted, so that the infoWindow is positioned according the evt mapPoint. Something like so:
on(featureLayerInstance, "click", function (evt) {
var graphic = evt.graphic;
var countryName = evt.graphic.attributes.CNTRY_NAME;
console.log(" got countryName" + countryName);
var alertDetailUrl = getAlertDetailsUrl(countryName);
console.log(" alertDetailUrl " + alertDetailUrl);
dojo.xhrGet({
url: alertDetailUrl,
handleAs: 'json',
load: function(data){
console.log("data ");
var popUpData = getPopUpContent(data);
map.infoWindow.setTitle(countryName);
map.infoWindow.setContent(popUpData);
map.infoWindow.show(evt.mapPoint);
console.log(" complete ");
},
error: dojo.hitch(this, "failure")
});
});
... View more
12-17-2013
06:11 AM
|
0
|
0
|
835
|
POST
|
You should be able to do that, similar to the map click event but use the feature layer onclick event instead.
on(featureLayerInstance, "click", function (evt) {
var graphic = evt.graphic;
var countryName = evt.graphic.attributes.CNTRY_NAME;
var template=new InfoTemplate();
console.log(" got countryName" + countryName);
var alertDetailUrl = getAlertDetailsUrl(countryName);
console.log(" alertDetailUrl " + alertDetailUrl);
dojo.xhrGet({
url: alertDetailUrl,
handleAs: 'json',
load: function(data){
console.log("data ");
var popUpData = getPopUpContent(data);
template.setTitle(countryName);
template.setContent(popUpData);
graphic.setInfoTemplate(template);
//You don't needto add the graphic to the map unless you want to give it a new selection symbol.
//map.graphics.add(graphic);
//graphic.show();
console.log(" complete ");
},
error: dojo.hitch(this, "failure")
});
});
... View more
12-16-2013
08:35 AM
|
0
|
0
|
835
|
POST
|
This is how I accomplish this action, using the Identify Task:
// Function to format info window content based on feature attributes
function featureContent(feature) {
var type = feature.attributes["TYPE"];
var notes = feature.attributes["NOTES"];
var baseContent = "<strong>Type:</strong> " + type;
if (notes) { baseContent += "<br/><strong>Info:</strong> <span class='data'>" + notes + "</span>"; }
return baseContent;
}
var idTask = new IdentifyTask(mapUrl);
var idParams = new IdentifyParams();
idParams.returnGeometry = true;
idParams.layerIds = [56, 59];
idParams.layerOption = IdentifyParams.LAYER_OPTION_TOP;
idParams.tolerance = 5;
function infoTask(evt) {
idParams.geometry = evt.mapPoint;
idParams.width = map.width;
idParams.height = map.height;
idParams.mapExtent = map.extent;
idTask.execute(idParams, function (idResults) {
if (idResults[0]) {
array.forEach(idResults, function (result) {
var selFeature = result.feature;
map.infoWindow.setTitle(result.layerName);
var content = featureContent(selFeature);
map.infoWindow.setContent(content);
map.infoWindow.show(evt.mapPoint);
});
}
}, null);
}
on(map, "click", infoTask);
... View more
12-13-2013
05:52 AM
|
0
|
0
|
835
|
POST
|
These services are also all unavailable: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services
... View more
12-13-2013
05:10 AM
|
0
|
0
|
1025
|
POST
|
I've been working on new widget to share and I've been loading the map services from ESRI's sample services, and today suddenly all the Feature Services are gone. Some of the REST urls are completely down. Can anyone tell me if these are going back up, going to be replaced or what? Kind of hitch in my development workflow. These urls are not loading at all: http://sampleserver6.arcgisonline.com/ArcGIS/rest/services/ http://www.sampleserver5.arcgisonline.com/ArcGIS/rest/services/ Those that are running do not contain any Feature Services.
... View more
12-13-2013
05:05 AM
|
0
|
6
|
2574
|
POST
|
I've have encountered this bug in 3.3 as well. I discovered that you can workaround it by setting the title AFTER you call setFeatures. Otherwise, any other configuration you employ to set the title will show up blank. My fix:
var selFeature = results[0].feature;
map.graphics.add(selFeature);
var selLayer = results[0].layerName;
selFeature.setInfoTemplate(template);
map.infoWindow.setFeatures([selFeature]);
//** IMPORTANT! **/
// YOU MUST SET THE TITLE **AFTER** CALLING SETFEATURES
map.infoWindow.setTitle(selLayer);
map.infoWindow.show(evt.mapPoint);
... View more
04-25-2013
10:51 AM
|
0
|
0
|
303
|
POST
|
I use the method described by dbecker above and it works fine. I have a page that loads data from a non-spatial table in SDE as a feature layer. Whenever a feature is selected, the attribute inspector is displayed and the user can edit values there.
... View more
12-13-2012
09:07 AM
|
0
|
0
|
555
|
POST
|
I seem to have found a fix, assuming our problems are related. I was getting errors whenever I used getSelectedFeatures() to return a graphic and then pass that graphic to applyEdits(). Try using featureLayer.clearSelection() before you call applyEdits(). That seems to do the trick. In my case, I noticed that every time I called applyEdits(), the feature I just updated/deleted was firing 'onSelectionComplete', which would return null and throw errors. I have no idea why using getSelectedFeatures() before applyEdits() triggers a feature selection upon 'onEditsComplete', but there it is. I hope that helps!
... View more
12-10-2012
10:41 AM
|
0
|
0
|
184
|
POST
|
FYI, I have encountered the same error under the same circumstances. It seems related to the use of featureLayer.getSelectedFeatures() to define the graphic. I have a function that fires whenever a feature is selected in my featureLayer, and that function is being triggered by the applyEdits() function somehow. Pretty strange behavior.
... View more
12-06-2012
10:36 AM
|
0
|
0
|
184
|
POST
|
I've tried this in 3.2 and I am encountering the same problem with the Attribute Inspector. It fails on most (but not all) feature selection operations, despite the fact that the correct features have been properly selected. The attribute inspector will not load. The same error occurs in all feature layers: "TypeError: _38a.toLowerCase is not a function" Editor-all.js (line 19) I'd really love to know how to fix this. I'm updating an existing editing application and the ability to select features and edit attributes is critical.
... View more
09-25-2012
06:49 AM
|
0
|
0
|
364
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|