Hello, I am currently running into an issue where when I select a featureLayer from the map, it will only give information on one of the featureLayers in a popup. And when I select the other two featureLayers, the popup reads "No Feature Selected." Below is code for the section I have been messing with trying to get the results I want, but so far nothing has worked. function initSelectToolbar(results) {
var operationalLayer = results[0,1,2].layer;
var selectQuery = new esri.tasks.Query();
dojo.connect(map, "onClick", function(evt) {
selectQuery.geometry = evt.mapPoint;
operationalLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW, function(features) {
if (features.length > 0) {
//store the current feature
updateFeature = features[0,1,2];
map.infoWindow.setTitle(features[0,1,2].getLayer().name);
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
} else {
map.infoWindow.hide();
}
});
});
dojo.connect(map.infoWindow, "onHide", function() {
operationalLayer.clearSelection();
});
var layerInfos = [{
'featureLayer': operationalLayer,
'showAttachments': true,
'isEditable': true,
'fieldInfos': [
{'fieldName': 'adres', 'isEditable':true, 'tooltip': 'Adres', 'label':'Adres:'},
{'fieldName': 'Buurten', 'isEditable':true, 'tooltip': 'idk', 'label':'Buurten'},
{'fieldName': 'B_STATUS', 'isEditable':true,'label':'B_STATUS'},
{'fieldName': 'FUNCTIE', 'isEditable':true, 'label':'FUNCTIE'},
{'fieldName': 'Straatnaam_conc', 'isEditable':true, 'label':'Straatnaam'},
{'fieldName': 'LENGTH', 'isEditable':true, 'tooltip': 'LENGTH', 'label':'Length:'},
{'fieldName': 'WEGKLASSE', 'isEditable':true, 'tooltip': 'LOLOLOLOL', 'label':'WEGKLASSE'},
{'fieldName': 'SHAPE_1_Length', 'isEditable':true,'label':'SHAPE_1_Length'},
{'fieldName': 'Oneway', 'isEditable':true, 'label':'FUNCTIE'},
{'fieldName': 'STRAATNAAM', 'isEditable':false, 'label':'Straatnaam'}
]
}];
var attInspector = new esri.dijit.AttributeInspector({
layerInfos:layerInfos
}, dojo.create("div"));
//add a save button next to the delete button
var saveButton = new dijit.form.Button({label:"Save","class":"saveButton"});
dojo.place(saveButton.domNode, attInspector.deleteBtn.domNode, "after");
dojo.connect(saveButton,"onClick",function(){
updateFeature.getLayer().applyEdits(null, [updateFeature], null);
});
dojo.connect(attInspector, "onAttributeChange", function(feature,fieldName,newFieldValue) {
//store the updates to apply when the save button is clicked
updateFeature.attributes[fieldName] = newFieldValue;
});
dojo.connect(attInspector,"onNext",function(feature){
updateFeature = feature;
console.log("Next " + updateFeature.attributes.OBJECTID);
});
map.infoWindow.setContent(attInspector.domNode);
map.infoWindow.resize(325, 220);
}
I have tried changing the layers but it does not seem to do anything helpful. And I have operationalLayer defined in my init, but it is a global variable. The link for it just references the basic FeatureServer page, without a link to a specific layer. For example its just FeatureServer, not FeatureServer/0 or anything like that. So what I am trying to do is have it so that when I select a feature, the information for that feature will display in the popup, no matter what feature it is. Any advice that can be given would be greatly appreciated. Thanks!Ryan