Hi all. I would love to be able to open a web app with a widget open AND already executed with some parameters. In my specific case this would be Robert Scheitlin, GISP 's awesome Identify Widget, so that when user opens the app he/she is presented with a map and a dashboard-like list of features (e.g. incidents, projects, etc.). Using browser debug tools I can see the query that is sent to the server with a number of parameters, but that's pretty much where my dev. skills end. How/where would I even start placing a function that makes that call after the page has fully loaded?
I think this same idea can be applied to many widgets, for example charts, or elevation profile, etc. Thanks for any help/suggestions/comments!
Solved! Go to Solution.
Tobias,
Well based on your use case this was a lot simpler then I thought. In your \server\apps\xx\widgets\Identify\widget.js change your startup function to look like this (lines 3 through 6):
startup: function () { this.inherited(arguments); if(this.config.identifyGeom){ html.setStyle(this.btnClear, 'display', 'block'); this.identifyGeom = new Polygon(this.config.identifyGeom); this.identifyFeatures(this.identifyGeom); } },
Then add this to your \server\apps\xx\configs\Identify\config_Identify.json:
"identifyGeom": {"rings":[[[-10383528.531827696,5615152.250596391],[-10383528.531827696,5622318.221998118],[-10369846.303764667,5622318.221998118],[-10369846.303764667,5615152.250596391],[-10383528.531827696,5615152.250596391]]],"spatialReference":{"wkid":102100}},
Tobias,
This is a pretty involved request. So let me get some details before I can even begin to point you in the right direction.
Robert:
#1 - a static, hard coded query in some place is absolutely sufficient in my case *
#2 - I assume openAtStart=true makes it simpler, so yes. Either way works, though.
Some more background: Currently a user needs to open this app that shows capital projects as polygon features (sorry, really early prototype). To get a list of all the capital projects the user needs to use the Identify Widget and draw a large polygon around the general area. He then gets this really nice list in the "Results" tab, with hover effects and all sorts of good stuff (thank you!). What I want to accomplish is that the nice "Results" list is there in the first place already.
*I can see that the Identify Widget make a call like http://...[my server + service] ...query?f=json&where=&returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=%7B%22rings%22%3A%5B%5B%5B-10383528.531827696%2C5615152.250596391%5D%2C%5B-10383528.531827696%2C5622318.221998118%5D%2C%5B-10369846.303764667%2C5622318.221998118%5D%2C%5B-10369846.303764667%2C5615152.250596391%5D%2C%5B-10383528.531827696%2C5615152.250596391%5D%5D%5D%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&geometryType=esriGeometryPolygon&inSR=102100&outFields=*&outSR=102100 . Hard coding this url in some place would work just fine for me.
Thank you very much. Tobias
Tobias,
Well based on your use case this was a lot simpler then I thought. In your \server\apps\xx\widgets\Identify\widget.js change your startup function to look like this (lines 3 through 6):
startup: function () { this.inherited(arguments); if(this.config.identifyGeom){ html.setStyle(this.btnClear, 'display', 'block'); this.identifyGeom = new Polygon(this.config.identifyGeom); this.identifyFeatures(this.identifyGeom); } },
Then add this to your \server\apps\xx\configs\Identify\config_Identify.json:
"identifyGeom": {"rings":[[[-10383528.531827696,5615152.250596391],[-10383528.531827696,5622318.221998118],[-10369846.303764667,5622318.221998118],[-10369846.303764667,5615152.250596391],[-10383528.531827696,5615152.250596391]]],"spatialReference":{"wkid":102100}},
Robert, all I can say is: you rock!
Thanks again,
Tobias