Select to view content in your preferred language

Problem loading custom dijit

3658
11
Jump to solution
02-03-2016 09:25 AM
DavidChrest
Deactivated User

Hello, I am having a serious problem trying to figure out how to load (dojoConfig) a custom dijit. There seems to be very little straightforward documentation on this. I am using Nicolas Haney's wonderful Select by Attributes Dijit found here: developer-support/web-js/select-by-attribute-widget at master · Esri/developer-support · GitHub

I copied code to my PC and all works well.

He loads the widget from a Dropbox URL like this:

var package_path = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
  var dojoConfig = {
  packages: [{
  name: "application",
  location: "https://dl.dropboxusercontent.com/u/79881075/SelectByAtt/"
            }]

In the README.md, he says, "Configure the dojo loader to pull from the widget's location:"

var package_path = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'));
  var dojoConfig = {
  packages: [{
  name: "application",
  location: "<path to the widget>"

I have AttributeSelection.js in my /js file. I have tried many things but cannot get it to load the widget from my own directory instead of his dropbox URL.

This also does not work:

dojoConfig = {
    packages: [
    {
                 name: 'application',
                 location: location.pathname.replace(/\/[^\/]*$/, '') + '/js'
             }
    ]
    };

Can somebody please help me with this tricky syntax to load the widget from my own folder.

Thank you so much for any help,

David

0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus

David,

  Here is the your project working on my end.

DavidChrest
Deactivated User

Yep, that does it! Thanks so very much! You patience and responses are greatly appreciated.

Looks like that AttributeSelection.html file needed to also be in the js folder along with AttributeSelection.js.

0 Kudos