Select to view content in your preferred language

How to create a Widget alongside Scalebar one's ?

857
3
01-04-2021 04:45 AM
Raphiki
Emerging Contributor

I'm trying to make a widget which will perform some background task.

The user should have no interaction with it, so I would like this widget was started on webapplication startup, and was not visible.

I read in the doc that a preload wirdget will fit my needs, and I just need to set the manifest's property inPanel to false :

{
  "name""BkgTask",
  "label""DEV",
  "platform""HTML",
  "type""widget",
  "version""2.8",
  "wabVersion""2.8",
  "copyright""2021",
  "properties": {
    "inPanel"false,
    "hasUIFile"false,
    "hasLocale"false,
    "hasStyle"false,
    "hasConfig"false,
    "hasSettingPage"false,
    "hasSettingUIFile"false,
    "hasSettingLocale"false,
    "hasSettingStyle"false
  }
}
 
And for the moment my Widget.js only do a : console.log("Hello world")
 
Then I upload my widget on my server and add it following this procedure: https://enterprise.arcgis.com/fr/portal/10.7/use/add-custom-widgets.htm#ESRI_SECTION1_BBB45680A0204E...
 
But when I start a WAB I don't see my custom widget near to Scalebar widget or other preloaded widget (see attached screenshot).
 
What I missed in my widget configuration ?
 
0 Kudos
3 Replies
shaylavi
Esri Contributor

Hi,

I suggest you start with the basics of creating a new widget and adding it into WAB before modifying and customizing advanced/different default settings.

Have you ever managed to create a custom widget and add it to a WAB application before? if not, start with that through the tutorials or ready examples you can use - https://developers.arcgis.com/web-appbuilder/sample-code/create-custom-in-panel-widget.htm

Once you managed to create a custom widget and add it successfully to a WAB app, you can configure it to launch automatically when the app starts either through the WAB interface or through the JSON file, but this should be your last concern, it's an easy fix and it sounds like your widget isn't created properly.

 

Shay.

Shay
0 Kudos
VictorTey
Esri Contributor

Hi @Raphiki , you have 2 options, one is to create one from scratch. Creating a onscreen widget is the same as creating all the other widget. The only difference is how you specify the manifest.json file.

example below

{
  "name": "ScaleNElevation",
  "platform": "HTML",
  "2D": true,
  "3D": false,
  "version": "2.16",
  "wabVersion": "2.16",
  "author": "Victor Tey",
  "description": "View current scale and set scale",
  "copyright": "",
  "license": "http://www.apache.org/licenses/LICENSE-2.0",
  "openAtStart":true,  
  "properties": {		
    "inPanel": false,
    "hasUIFile": true,
    "supportMultiInstance": false,
    "closeable": false,
    "hasSettingPage": false,
    "hasSettingUIFile" : false,
    "hasConfig" : true,
    "position": {
        "left": 10,
        "bottom": 60
     }    
  } 
}

 Note the inPanel: false, closable false and position to place the widget. Above is a working copy of my manifest.json. Hope that helps

 

0 Kudos
Raphiki
Emerging Contributor

I succeed in making widget starting at application loading with openAtStart. Thanks a lot !

But now how to hide the plugin's icon ? The user has no interaction with the plugin so the icon is useless and confusing...

0 Kudos