wabWidget use?

752
7
Jump to solution
01-17-2018 10:09 PM
LefterisKoumis
Occasional Contributor III

I am trying to use the replicate the functionality of wabWidget as it is used in the AddData widget in the AddFromUrlPanel.js under the addClicked function.

In that widget, the use of:

 wabWidget= null;
 var map = this.wabWidget.map;

the map variable produces all the info for the map.

console.log(map):

......

......

However if I attempt to use the above scripting for for a custom function to get the variable map, I get the error: 

What am I missing to get the same output for the map?

Thank you.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Or you missed a comma in your define array.

View solution in original post

7 Replies
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

   When you construct and add the AddFromUrlPanel to your widget you need to pass a reference to your widget to the AddFromUrlPanels wabWidget property.

0 Kudos
LefterisKoumis
Occasional Contributor III

Thank you Robert. Do you mean using publishData to get access to the wabWidget from the  AddFromUrlPanels.js?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Lefteris,

  Nope, not at all. If you examine how the AddData widget uses the AddFromUrlPanel dijit you will see that it sets the wabWidget property in the dijits constructor or just using its property (I am not where I can look at the source code today). So you need to examine the code closer to see exactly how the Add Data widget is using it.

0 Kudos
LefterisKoumis
Occasional Contributor III

The addData widget it defines the AddFromURLPane

"./search/AddFromUrlPane",

and it initializes the wabWidget by:

this.addFromUrlPane = new AddFromUrlPane({
            wabWidget: this
          },this.urlNode);‍‍‍

What I am trying to do is to add wms layer.  So, I used the script posted below. I defined the LayerLoader,js and utils.js

and "esri/layers/WMSLayer"

but I get the error:

Based of what I read, the error is caused by proxy. However, I already setup the proxy and the question is how the addData works if there is a problem with proxy? 

addWMSLayerToMap: function() {
                      
                
                var url="https:/xxx/wms"
               
                var loader = new LayerLoader();
                var id = loader._generateLayerId();

                var self = this,
                  layer = null;


                  layer = new WMSLayer(url, {
                    id: id
                  });
                  loader._waitForLayer(layer).then(function(lyr) {
                    //console.warn("_waitThenAdd.ok",lyr);
                    //var templates = null;

                      loader._setWMSVisibleLayers(lyr);

                    lyr.xtnAddData = true;
                    this.map.addLayer(lyr);
                  })
            },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
RobertScheitlin__GISP
MVP Emeritus

Sounds to me like you do not have WMSLayer class defined in your code.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Or you missed a comma in your define array.

LefterisKoumis
Occasional Contributor III

How many times I kept checking the define array only just now saw that I just switched the order. Thank you Robert.

0 Kudos