Select to view content in your preferred language

Is there a list of available jimu/dijit that can be used in web appbuilder developer edition?

3314
14
10-30-2019 04:19 AM
by Anonymous User
Not applicable

I understand that there is some documentation available, but it seems sparse and does not provide good examples of how to implement the various dijits. Below is the documentation that I am aware of.

WidgetManager class—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers 

Tags (2)
0 Kudos
14 Replies
KenBuja
MVP Esteemed Contributor

Which dijit are you using? You have to supply an array of layers for the FeatureSetChooserForMultipleLayers (which is just one layer in my example above). The FeatureSetChooserForSingleLayer dijit uses a different constructor

this.selectDijit = new FeatureSetChooserForSingleLayer({
  map: this.map,
  featureLayer: this.yourLayer,
  updateSelection: true
});‍‍‍‍‍‍‍‍‍‍
0 Kudos
by Anonymous User
Not applicable

I’d like to use FeatureSetChooserForMultipleLayers since it has the point selection geometry type as a choice. Will this dijit accept a single layer in the form of an array?

0 Kudos
KenBuja
MVP Esteemed Contributor

Yes, done like this

this.selectDijit.setFeatureLayers([this.yourLayer]);
0 Kudos
by Anonymous User
Not applicable

Hi Ken,

Thanks for you response. I have tried what you suggested and I am no longer getting that error I was before. Now I am just simply trying to return selected features with no luck. Below is my code:

//Get Map layer IDs
mapLayers = this.map.layerIds;

//Get layer based on ID
adoptACityStreets = this.map.getLayer(this.map.layerIds[1]);

//Get the layer that should be selectable
availableStreets = adoptACityStreets['url'] + "/1";

//Create select dijit (this is roughly based on the select widget's setup)
this.selectDijit = new FeatureSetChooserForMultipleLayers({
  map: this.map,
  updateSelection: true,
  fullyWithin: this.config.selectionMode === 'wholly',
  geoTypes: ['POINT'] || ['EXTENT']
});

//Place the select dijit in the DOM
this.selectDijit.placeAt(this.selectionContainer);
this.selectDijit.startup();

//Set the feature layer for the select dijit
this.selectDijit.setFeatureLayers([availableStreets]);

this.own(
  on(
  this.selectDijit,
  "unloading", //not sure what loading vs unloading does
  dojo_lang.hitch(this, function(evt) {
  console.log(evt)
  const features = adoptACityStreets.getSelectedFeatures();
  console.log(features)
     })
   )   
);
0 Kudos
KenBuja
MVP Esteemed Contributor

I set just about all my variables in "this" when I construct the widget. For example, the variable "_layerSPGrid" is the layer I'm adding the the selectDijit.

export default declare([BaseWidget, _WidgetsInTemplateMixin], {
  baseClass: "spatial-prioritization",
  //... setting variable
  _layerSPGrid: null,
  //... more variables

So when I use it throughout the code, I'm always referring to that variable

this._layerSPGrid = new FeatureLayer(this._SPGridUrl + "/0", {
  outFields: ["*"],
  id: "Priority"
});
this.selectDijit.setFeatureLayers([this._layerSPGrid]);
this.own(
  on(
    this.selectDijit,
    "unloading",
    lang.hitch(this, function() {
      const features = this._layerSPGrid.getSelectedFeatures();
      console.log(features)
    })
 )
);

The "unloading" event is what's fired when you've finished drawing the selection geometry from the selectDijit.