How do I refresh the attributes of the map graphics and update the Attribute Inspector to show new attributes after an edit operation?

09-02-2015 12:31 PM
Occasional Contributor II

I'm continuing working on enhancements on the edit widget.  I've built an Object Class Extension to generate a uniqueID and populate a field based on some rules, I've deployed it and it works well.

When you make an edit to one of five fields the values of those fields are combined to populate a sixth field in the object class extension.  When I make an edit to one of those five fields the applyEdits function fires and sends the update (updating all fields?).  The class extension fires and fills in the sixth field.  The attribute inspector doesn't know this happens and doesn't reflect the result for the sixth field.

I'm working on how to update the attribute inspector on an event and feel close.  I've hooked onto some events that fire which I'd expect to update the features in the feature layer and then refresh the inspector, I'm not getting the result I want.  I see query requests being sent to the feature service, but the graphics layer isn't reflecting the change and therefore the attribute inspector isn't showing it either.  My hooks onto the query events aren't firing at this time.  I think the inspector is refreshing and just reshowing the same values it already had.  When I pan the map all the query events I've hooked onto fire appropriately, reopening the attribute inspector shows what I've been looking for.

Any thoughts would be appreciated...  It almost seems like the api is preventing the other events from firing during an edit process.


onOpen function from my Edit Widget, creates some hooks onto the feature layers if the specified event happens

onOpen: function() {
    if (typeof this.hasAlreadyHitchedLayerChanges === "undefined") {
        featureLayerCount =;
        for(i = 0; i < featureLayerCount; i++){
            var layerID =;
            var fLayer =;
            if(fLayer !== undefined)  {
                fLayer.on("edits-complete", OnEditsCompleteHandler);//OnEditsCompleteHandler
                fLayer.on("query-features-complete", OnQueryFeaturesComplete);
                fLayer.on("query-extent-complete", OnQueryFeaturesComplete);
                fLayer.on("query-ids-complete", OnQueryFeaturesComplete);
                fLayer.on("update", OnQueryFeaturesComplete);

        this.hasAlreadyHitchedLayerChanges = true;


The two functions that fire when the events are detected.

function OnEditsCompleteHandler(evt){

    //alert("it worked!  Here's the data: " + evt);
    var wm = WidgetManager.getInstance();
    var editWidget = wm.getWidgetsByName('Edit')[0];
    var theLayerInfos = editWidget.editor.attributeInspector.layerInfos;
    for (var i=0; i<theLayerInfos.length; i++) {
        var theLayerID = theLayerInfos.layerId;
        var theLayerToRefresh =;
        theLayerToRefresh.refresh(); //seems to cause requests to the feature service that aren't reflected in the map?
        theLayerToRefresh.redraw(); //probably unnecessary
        editWidget.attributeInspector.refresh(); //not showing my updated data


function OnQueryFeaturesComplete(evt) {
    alert("it worked!  Here's the data: " + evt);
0 Kudos
1 Reply
Occasional Contributor II

Followup and potentially more straight forward question. 

Does the fact that I'm editing a feature (selected it and popped open the attribute inspector) cause the viewer to somehow prevent other layers from being queried or events from firing?  I'm using the edit widget with web app builder 1.2

It appears that while I'm editing a line feature and zoom out while the line is selected and attribute inspector is open only the line feature redraws, only the already requested data for background maps and other dynamic layers is displayed.

0 Kudos