How do I pass value from config file?

1798
3
Jump to solution
01-21-2016 07:02 AM
MonikaHonkova2
New Contributor II

Hello,

I changed the Attribute Table widget. In the setting page of the widget I set a value of the map scale I want my map to zoom to if I select a point feature in the attribute table. Reason - I'm only using our own background maps which are dynamic map services. The code in the _FeatureTable.js is designed to work with tiled basemaps. Every "Zoom to" click I make, the map zooms closer and closer.

I could hard code the value in the _FeatureTable.js but I'd rather control it through the widget setting. My question is how to pass the config value from the config file to the _FeatureTable.js?

        } else if (method === "zoom") {

          this.getExtent(result).then(lang.hitch(this, function(gExtent) {

            if (gExtent) {

              if (gExtent.type === "point") {

                var currentScale = this.map.getScale();

                var factor =  MY ZOOM SCALE FROM CONFIG / currentScale;

                levelOrFactor = this.map.getMaxZoom() > -1 ? this.map.getMaxZoom() : 0.1;

                this.map.centerAndZoom(gExtent, factor);

Thanks for any help, Monika

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Monika,

   Glad to help. Make sure to mark this thread as answered.

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Monika,

  Are you already adding this zoom value to the widgets config.json using the getConfig function?

this.config.zoomScale = this.yournumbertextboxcontrol.get('value');

If so then you should be able to do this in the _FeatureTable.js

var factor = this.parentWidget.config.zoomScale;

MonikaHonkova2
New Contributor II

Hi Robert,

yes, I've been already adding the value to the config. But I wasn't sure how to get hold of it and your line of code worked!

Thanks a lot for your help, Monika

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Monika,

   Glad to help. Make sure to mark this thread as answered.

View solution in original post

0 Kudos