Class: AttributeInspector

Description

Class added v2.0.

Load the AttributeInspector using one of the dojo.require statements below. See the Coding Guidelines help topic for details.

dojo.require("esri.dijit.AttributeInspector-all");
or
dojo.require("esri.dijit.AttributeInspector");

The attribute inspector displays the attributes of selected features from one or more feature layers. If the layer is editable, the feature attributes will be editable. The AttributeInspector widget honors the domains and subtypes as defined by the Feature Service. The widget is used by the Editor widget, but can also be used directly in both editing and "show attributes" scenarios. While commonly put into an InfoWindow, you can also put it into other containers, for example outside of the map or without using a map.

If the feature layer supports attachments, attachments will be visible in the attribute inspector. If the feature layers are from a feature service then attribute inspector will include the ability to create, view and delete attachments.

Samples

Search for samples that use this class.  

Class hierarchy

esri.dijit.AttributeInspector

Constructor

Constructor Description
esri.dijit.AttributeInspector(params, srcNodeRef) Creates a new Attribute Inspector object.

Methods

Method Return Value Description
destroy() none Destroys the widget, used for page clean up.
first() none Moves to the first feature.
last() none Moves to the last feature.
next() none Move to the next feature.
previous() none Move to the previous feature.
refresh() none Updates the contents of the AttributeInspector.

Events

Event Description
onAttributeChange(feature, fieldName, fieldValue) Fires when a fields value changes.. When used outside of the Editor widget it is up to the developer to update the feature's attributes.
onDelete(feature) Fires when the AttributeInspector's delete button is pressed. When used outside of the Editor widget it is up to the developer to delete the feature from the feature service.
onNext(feature) Fires when the AttributeInspector's next or back button is pressed. Corresponds to the feature currently displayed in the AttributeInspector
Constructor Detail

esri.dijit.AttributeInspector(params, srcNodeRef)

Creates a new Attribute Inspector object.
Parameters:
<Object> params Required See options list.
<String> srcNodeRef Required HTML element where the attribute inspector should be rendered.
Options:
<Object[]> layerInfos

Array of result objects with the following properties

<a href="FeatureLayer.htm">FeatureLayer featureLayer Array of feature layers. Required.
<Boolean> showObjectID Show the ObjectID field.Optional.
<Boolean> showGlobalID Show the GlobalID field. Optional
<Boolean> showDeleteButton Display the delete button on the attribute inspector dialog. Optional
<String[]> htmlFields Display a rich text editor for the specified fields.
Code snippets:
attInspector = new esri.dijit.AttributeInspector({
  layerInfos: [{
    'featureLayer': feedbackLayer,
    showDeleteButton: true,
    showObjectID: false
  },
  {
    'featureLayer': streetsLayer,
    showDeleteButton: true,
    showObjectID: false
  }]
}, "attrInspector");
Methods Detail

destroy()

Destroys the widget, used for page clean up.
Return value: none

first()

Moves to the first feature.
Return value: none

last()

Moves to the last feature.
Return value: none

next()

Move to the next feature.
Return value: none

previous()

Move to the previous feature.
Return value: none

refresh()

Updates the contents of the AttributeInspector.
Return value: none

Events Detail

onAttributeChange(feature, fieldName, fieldValue)

Fires when a fields value changes.. When used outside of the Editor widget it is up to the developer to update the feature's attributes.
Arguments:
<Graphic> feature The feature to be updated.
<String> fieldName The name of the field that was modified.
<String> fieldValue Value for the field that was modified.
Code snippets:
 dojo.connect(attInspector, "onAttributeChange", function(feature,fieldName,newFieldValue) {
  feature.attributes[fieldName] = newFieldValue;
  feature.getLayer().applyEdits(null, [feature], null);
});

onDelete(feature)

Fires when the AttributeInspector's delete button is pressed. When used outside of the Editor widget it is up to the developer to delete the feature from the feature service.
Arguments:
<Graphic> feature Feature to be deleted.
Code snippets:
 dojo.connect(attInspector, "onDelete",function(feature){
  feature.getLayer().applyEdits(null,null,[feature]);
  map.infoWindow.hide();
});

onNext(feature)

Fires when the AttributeInspector's next or back button is pressed. Corresponds to the feature currently displayed in the AttributeInspector
Arguments:
<Graphic> feature Current feature displayed in the attribute inspector.
Code snippets:
dojo.connect(attInspector, "onNext", function(feature) {
  var screenPoint = map.toScreen(feature.geometry.getExtent().getCenter());
  map.infoWindow.show(screenPoint,map.getInfoWindowAnchor(screenPoint));
});