Show GP result in a map

319
2
Jump to solution
03-01-2018 07:48 AM
Helenpeng
New Contributor III

I am creating a widget by using GP service. My code works fine in Sandbox. When I move into the widget, the first part of running Geoprocessor is fine and I can see the feature result in Console Window, but my last part - the graphic result cannot show in the map. The error message says “this.map.graphics is undefined”.

I attach my widget code and sandbox code. My widget code is to open the widget then the GP starts. I wonder how to make the GP result shows in the map.

Thanks,

Helen

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Helen,

   So you just forgot the lang.hitch part:

//you have
this.gp.execute(params, this.getDriveTimePolys);
//Should be
this.gp.execute(params, lang.hitch(this, this.getDriveTimePolys));‍‍‍‍‍‍

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Helen,

   So you just forgot the lang.hitch part:

//you have
this.gp.execute(params, this.getDriveTimePolys);
//Should be
this.gp.execute(params, lang.hitch(this, this.getDriveTimePolys));‍‍‍‍‍‍
Helenpeng
New Contributor III

Robert,

Thank you very much for the help. You are right and it works now. I should give it try by using --

this.gp.execute(params, lang.hitch(this, this.getDriveTimePolys))

Best,

Helen

0 Kudos