Can't load new modules

1556
11
10-19-2016 12:33 PM
deleted-user-0W0-oLHxDjCX
New Contributor III

Hello everyone

I am with a problem to load a new module using WAB dijits.

My javascript file is defined like this:

console.log("loading myscrip.js ...");
define([
'dojo/_base/declare'
, 'esri/map'
, 'dojo/dom'
], function (declare, map, dom) {
return declare(null, {
filtrar: function () {
console.log("filter");
var lryToFilter = map.getLayer("filterparameter");
if (lryToFilter== null) {
console.log("can't filter");
}
else {
map.removeLayer(lryToFilter);
}
}
});
});

This file is on app/jmu.js folder and refered on index.html at: 

.

.

.

<script src="simpleLoader.js "></script>
<script src="init.js "></script>
<script src="jimu.js/myscrip.js"></script>

I am getting the following error:

0 Kudos
11 Replies
Drew
by
Occasional Contributor III

removed my reply.. i noticed it was not correct

0 Kudos
deleted-user-0W0-oLHxDjCX
New Contributor III

I don't think so cgishack Commas are just in one side.

0 Kudos
Drew
by
Occasional Contributor III

Here is my Blank Widget.js for the WAB. This should work for you as a sample.

define([

  "jimu/BaseWidget",

  "dojo/_base/declare",
  "dojo/on",
  "dojo/dom-construct",
  "dojo/dom",
  "dojo/dom-style",
  "dojo/query",
  "dojo/dom-class",
  "dojo/dom-attr",
  "dojo/keys",
  "dojo/store/Memory",
  "dojo/_base/fx",
  "dojo/_base/window",
  "dojo/dom-geometry",

],
function (BaseWidget,
    declare, on, domConstruct, dom, domStyle, query, domClass, domAttr, keys, Memory, fx, win, domGeom)
{
    return declare([BaseWidget], {

        baseClass: 'sc-widget-',
        name: 'SC-BlankWidget',

        constructor: function ()
        {
            this.inherited(arguments);
        },

        startup: function ()
        {
            this.inherited(arguments);
            
            alert('hello World')
        },
    });
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
Drew
by
Occasional Contributor III

Also.. I might be confused on what you are doing.. 
I assumed you were trying to create a new widget. If that is the case you don't load it in the HTML file. You define it in the config.json file

I am confused about this reference

<script src="jimu.js/myscrip.js"></script>
0 Kudos
deleted-user-0W0-oLHxDjCX
New Contributor III

Dear Andrew Timmins‌ my module doesn't have any GUI I would like only to have access to the map to make some layer filterings.

I have a huge ammount of layers and would be a great advance to be able to filter some layers.

0 Kudos
Drew
by
Occasional Contributor III

You can create an invisible widget by setting "inPanel" to false in the manifest.json file

"copyright": "",
  "license": "",
 "properties": {
        "inPanel":  false,
        "hasConfig": false,
        "hasLocale": false,
deleted-user-0W0-oLHxDjCX
New Contributor III

Could you tell me how do I refer my new widget in other widget (i.e. LayerListWidget) ?

0 Kudos
deleted-user-0W0-oLHxDjCX
New Contributor III

So you can figure out, my intent is to provide a layer filter functionality as you can see on the image below:

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Why not just toggle the layers on and off then?

https://community.esri.com/docs/DOC-8592 

0 Kudos