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:
removed my reply.. i noticed it was not correct
I don't think so cgishack Commas are just in one side.
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')
},
});
});
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>
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.
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,
Could you tell me how do I refer my new widget in other widget (i.e. LayerListWidget) ?
So you can figure out, my intent is to provide a layer filter functionality as you can see on the image below:
Why not just toggle the layers on and off then?