Activate edit widget from query result set ?

2684
8
Jump to solution
07-15-2016 12:08 PM
Hoang_YenHa
New Contributor II

All,

Is there a way to activate edit widget when you zoom to a feature from your query result set ?  I love using the enhanced search.  Thank you so much Robert!  You save me a lot of time and headache.

I've doing some readings and look like ESRI doesn't make query and edit widgets "talk" to each other yet.

Can anyone help me to locate chunk of codes to call the edit widget from query or enhanced search widgets ?  I really need to make it happen for my project.

Thanks,

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Hoang Yen Ha,

  In that case in the _onResultsTableClicked function update my changes to:

/*RJS - start edits*/             
              //this.map.infoWindow.show(centerPoint);
              if (this.wManager) {
                var widgetCfg = this._getWidgetConfig('Edit');
                if(widgetCfg){
                  this.wManager.triggerWidgetOpen(widgetCfg.id).then(lang.hitch(this, function(widget){
                    setTimeout(lang.hitch(this, function(){
                      var mpPt = feature.geometry;
                      var scrPt = this.map.toScreen(mpPt);
                      this.map.emit("click", { bubbles: true, cancelable: true, screenPoint: scrPt, mapPoint: mpPt });
                    }), 1000);
                  }));
                }
              }
/*RJS - end Edits*/

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

Hoang,

  What theme are you working with in your app? It makes a difference when it comes to the code needed.

0 Kudos
Hoang_YenHa
New Contributor II

Right now I'm using Foldable theme.  Thank you.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Hoang Yen Ha,

  In that case then the changes to make to the Query Widgets Widget.js file are commented in the attached edited Widget.js

Hoang_YenHa
New Contributor II

I forgot to mention it's the attribute edit that I need.  With your modified codes, I could get the edit window popup to do geometry edit but I still can't get to the attributes.  Clicking on the attributes button on Edit window doesn't populate the attribute edit table at all.

My bad for not being clear at the beginning.

Thank you

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Hoang Yen Ha,

  In that case in the _onResultsTableClicked function update my changes to:

/*RJS - start edits*/             
              //this.map.infoWindow.show(centerPoint);
              if (this.wManager) {
                var widgetCfg = this._getWidgetConfig('Edit');
                if(widgetCfg){
                  this.wManager.triggerWidgetOpen(widgetCfg.id).then(lang.hitch(this, function(widget){
                    setTimeout(lang.hitch(this, function(){
                      var mpPt = feature.geometry;
                      var scrPt = this.map.toScreen(mpPt);
                      this.map.emit("click", { bubbles: true, cancelable: true, screenPoint: scrPt, mapPoint: mpPt });
                    }), 1000);
                  }));
                }
              }
/*RJS - end Edits*/
Hoang_YenHa
New Contributor II

I got it!  Thank you so very much Robert!  I can't just thank you enough!

Is it possible for me to try the same thing with your Enhanced Search Robert ?  or it's a lot more complicated than what you just did ?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Hoang Yen Ha,

  This is not possible with the eSearch as the eSearch does not use the real graphic from the Map Service as the Query widget does. The eSearch creates a clientside FeatureLayer.

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.

Hoang_YenHa
New Contributor II

Thank you Robert!

0 Kudos