Loading ArcGIS Online Data from a custom Widget

3028
7
Jump to solution
09-16-2015 12:26 AM
FlorianCADOZ
Occasional Contributor

Hi everyone,

I will wish to create a widget in which the user can select and load a layer from ArcGIS OnLine portal organization.

I seem to have found an appropriate solution here but I do not understand at all how it works or how to use it ...

Can you confirm that this tool suits my needs and help me understand a little how to integrate my dévellopement and how to customise it ?

Thanx a lot by advance,

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

   The QueryServiceChooserFromPortal.js is in the jimu.js\dijit folder and required/referenced by the QueryableLayerSource.js.  If you want the popup dialog ability but not the other tabs and radio button options that you see in the _QueryableLayerSourcePopup then you need to use the jimu/dijit/Popup this is what gives you the popup dialog to house your content.

Right now the _QueryableLayerSourcePopup.js  uses jimu/dijit/Popup to display the popup dialog that contains the jimu/dijit/QueryableLayerSource is the content of the popup that has the 3 radio buttons Select from Map, Add from ArcGIS Online, Add Service URL. Since you are only interested in the "Add from ArcGIS Online" portion then you can just add the jimu/dijit/QueryableServiceChooserFromPortal to your js code that uses jimu/dijit/Popup.

View solution in original post

7 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

   Yes I would say that is the route to go with. If you need an example of how to work with it the Query widget settings dialog uses it by using the jimu/dijit/_QueryableLayerSourcePopup which uses jimu/dijit/QueryableLayerSource which uses jimu/dijit/QueryableServiceChooserFromPortal which uses jimu/dijit/ItemSelector

FlorianCADOZ
Occasional Contributor

oh yeah thx, it should be a good way for beguinning !

I also would like to know if it's possible to custom the UI ! For exemple I would have only the content tab and not the 3 others...Do you know if it's possible ?
Sans titre.png

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

   Sure with some code edits.

0 Kudos
FlorianCADOZ
Occasional Contributor

Hello,


I'm sorry but I don't really understand how the widget Query is working because of all his files ( Setting, SingleQuerySetting , SortFields , PopupConfig , etc.) and I also don't understand how to use the different dijit...

For exemple, you talked about jimu/dijit/_QueryableLayerSourcePopup which uses jimu/dijit/QueryableLayerSource which uses jimu/dijit/QueryableServiceChooserFromPortal which uses jimu/dijit/ItemSelector but I only found the jimu/dijit/_QueryableLayerSourcePopup in the SingleQuerySetting.js and the Setting.js but I really don't understand how to use and custom it...

In parallel, I tried to use the ItemSelector, that was really simplest to load it in my custom widget, but, connected or not, it didn't want to show my data on my AGOL portal... (you can see it in my last screenshot)

I'm a little disarmed right now...

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

  I have had no need to do this myself so I can only point you to what I see used in existing widgets. In the QueryServiceChooserFromPortal.js file it inits the ItemSelector using this code:

      //init selector
      this.selector = new ItemSelector({
        portalUrl: this.portalUrl,
        itemTypes: ['Feature Service', 'Map Service', 'Image Service'],
        onlyShowOnlineFeaturedItems: false
      });
      this.own(on(this.selector, 'item-selected', lang.hitch(this, this._onItemSelected)));
      this.own(on(this.selector, 'none-item-selected', lang.hitch(this, this._onNoneItemSelected)));
      this.selector.placeAt(this.selectorContainer);
      this.selector.startup();

Are you doing similar? Can you translate the error message that appears in your screenshot?

0 Kudos
FlorianCADOZ
Occasional Contributor

Huuum I don't have a QueryServiceChooserFromPortal.js in the query widget...

And I would like to load a popup with my itemselector when I click on the Agol radiobutton but the native itemselector doesn't want to sync with my AGOL portal and I don't understand how to use properly the _QueryableLayerSourcePopup...

Sorry for the error message, it said something like : Your login session has expired. Refresh your browser to reconnect to your portal.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Florian,

   The QueryServiceChooserFromPortal.js is in the jimu.js\dijit folder and required/referenced by the QueryableLayerSource.js.  If you want the popup dialog ability but not the other tabs and radio button options that you see in the _QueryableLayerSourcePopup then you need to use the jimu/dijit/Popup this is what gives you the popup dialog to house your content.

Right now the _QueryableLayerSourcePopup.js  uses jimu/dijit/Popup to display the popup dialog that contains the jimu/dijit/QueryableLayerSource is the content of the popup that has the 3 radio buttons Select from Map, Add from ArcGIS Online, Add Service URL. Since you are only interested in the "Add from ArcGIS Online" portion then you can just add the jimu/dijit/QueryableServiceChooserFromPortal to your js code that uses jimu/dijit/Popup.