I have feature layers for which the features are created in ArcMap but the attributes can be edited through the web app. Previously the user would initiate full editing through an editor like layers with geometry editing. To simplify things, I'm switching to an attribute inspector in the popup for these attribute edit only layers. Using the attribute inspector sample as inspiration I have it up and running.The problem is the inspector is shown only on the first click/feature selection. Subsequent clicks return no content, i.e. the attribute inspector, in the popup content for the same or any other feature. The popup title updates but no inspector. Why?[ATTACH=CONFIG]28199[/ATTACH][ATTACH=CONFIG]28200[/ATTACH]This is the config object used to create the layer; it is variable l in the code below:{
url: 'http://URL/arcgis/rest/services/Control/FeatureServer/0',
token: true,
tokenType: 'base', //base or custom
tokenCustom: '',
source: 'feature', //feature or map
name: 'Control',
id: 'fl_control',
mode: 1,
outFields: ['*'],
visible: false,
opacity: 1,
minScale: 0,
maxScale: 0,
legend: true,
infoTemplate: {
type: 'inspector', //inspector, text, function or table
titleText: 'Control: ${PROJECT} - ${POINT_NUM}',
contentText: '${*}',
contentFunction: function (graphic) {},
contentInspector: {
isEditable: true,
showObjectID: false,
showGlobalID: false,
showAttachments: false,
showDeleteButton: false,
fieldInfos: [
{
fieldName: 'PROJECT',
label: 'Project',
isEditable: true
}, {
fieldName: 'POINT_NUM',
label: 'Point No.',
isEditable: true
}, {
fieldName: 'NORTHING',
label: 'Northing',
isEditable: false
}, {
fieldName: 'EASTING',
label: 'Easting',
isEditable: false
}, {
fieldName: 'ELEV',
label: 'Elevation',
isEditable: false
}, {
fieldName: 'DESCRIPTION',
label: 'Description',
isEditable: true
}, {
fieldName: 'PROJECTION',
label: 'Projection',
isEditable: false
}, {
fieldName: 'NOTES',
label: 'Notes',
'stringFieldOption': 'textarea',
isEditable: true
}
]
}
},
identify: true,
query: true,
queryLayer: 0, //same as feature layer TO DO: extract from url instead
queryParams: {
//query params
},
edit: true,
editParams: {
//editor params
},
info: true,
infoType: 'text', //text or href
infoContent: 'Layer info...' //info text (html) or url
}
This is the info template portion of the code that creates a feature layer; layer is the feature layer.var it = new esri.InfoTemplate();
if (l.infoTemplate.type === 'inspector') {
var layerInfo = {
featureLayer: layer,
isEditable: l.infoTemplate.contentInspector.isEditable,
showObjectID: l.infoTemplate.contentInspector.showObjectID,
showGlobalID: l.infoTemplate.contentInspector.showGlobalID,
showAttachments: l.infoTemplate.contentInspector.showAttachments,
showDeleteButton: l.infoTemplate.contentInspector.showDeleteButton
}
if (l.infoTemplate.contentInspector.fieldInfos !== undefined) {
layerInfo.fieldInfos = l.infoTemplate.contentInspector.fieldInfos;
}
layer.inspector = new esri.dijit.AttributeInspector({
layerInfos: [layerInfo]
}, dojo.create('div'));
dojo.style(layer.inspector.layerName, 'display', 'none');
layer.inspector.on('attribute-change', function (result) {
var feature = result.feature;
var atts = feature.attributes;
for (var i in atts) {
if (i === result.fieldName) {
atts = result.fieldValue;
}
}
layer.applyEdits(null, [feature], null, function (a, u, d) {
console.log(u[0]);
}, function (error) {
console.log(error);
});
});
it.setContent(layer.inspector.domNode);
it.setTitle(l.infoTemplate.titleText);
layer.on('click', function (evt) {
var query = new esri.tasks.Query();
query.where = 'OBJECTID = ' + evt.graphic.attributes.OBJECTID;
//console.log(evt.graphic);
layer.selectFeatures(query, 3, function (features) {
console.log(features);
});
});
app.map.infoWindow.on('hide', function () {
layer.clearSelection();
console.log('infoWindow hidden');
});
} else if (l.infoTemplate.type === 'text') {
//text
} else if (l.infoTemplate.type === 'table') {
//table
} else if (l.infoTemplate.type === 'function') {
//function
}
layer.setInfoTemplate(it);
Thanks for any help or suggestions.