How to reduce the symbols in the WAB Editor Widget?

273
5
Jump to solution
11-15-2017 09:15 AM
KarstenRank
Occasional Contributor III

Hi there,

is it possible to reduce the symbols in the WAB Editor Widget?

I have symbols in different states (e.g 1,2,3) and when opened the widget, only symbols with state 1 should be shown and be creatable.

The changes to 2 or 3 should be changeable within the value of field, which is responsible for the symbol.

Thanks in advance,

Karsten

0 Kudos
1 Solution

Accepted Solutions
RalfWeinreich1
New Contributor

Karsten,

you can also do that in the webmap.

  • Open the webmap in the viewer
  • Start editing 
  • Open the feature-management (manage new features)
  • If necessary add new types
  • At the featuretypes you don't want to see when creating new features remove the templates
    remove template

  • It looks like that
    removed
    • Thats the result
      in the map viewer                                            in the WAB edit widget
      resultin WAB
  • After creating, you can select all types in the popup

If you use ArcGIS Pro you can delete the Symbols from the feature template before sharing the map or layer.

View solution in original post

5 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Karsten,

   Sure you can. Here is the Edit widgets Widget.js _getTemplatePicker function updated to filter items based on a hard coded string (line 31 - 49 added): The filter term is 'Robbery' in line 39.

      _getTemplatePicker: function(layerInfos) {
        this._layerObjectsParaForTempaltePicker = [];

        array.forEach(layerInfos, function(layerInfo) {
          if(layerInfo.featureLayer &&
            layerInfo.featureLayer.getEditCapabilities &&
            layerInfo.featureLayer.getEditCapabilities().canCreate) {
            this._layerObjectsParaForTempaltePicker.push(layerInfo.featureLayer);
          }
        }, this);

        // change string of templatePicker is empty
        this._defaultTempaltePickerEmpeyStr =
            esriBundle.widgets.templatePicker.creationDisabled;
        if(this._canCreateLayersAreAllInvisibleFlag) {
          esriBundle.widgets.templatePicker.creationDisabled =
            this.nls.noCanCreateLayerAreCurrentlyVisible;
        }

        var bottomStyle = this._configEditor.toolbarVisible ? "" : "bottom: 0px";
        var topStyle = this._configEditor.useFilterEdit ? "top: 115px" : "top: 18px";
        var templatePicker = new TemplatePicker({
          featureLayers: this._layerObjectsParaForTempaltePicker,
          grouping: true,
          rows: "auto",
          columns: "auto",
          style: bottomStyle + ";" + topStyle
        }, html.create("div", {}, this.domNode));
        templatePicker.startup();

        var origFunc = templatePicker.constructor.prototype._getItemsFromLayer;

        templatePicker._getItemsFromLayer = lang.hitch(this, function () {
          var items;
          items = origFunc.apply(templatePicker, arguments);

          items = array.filter(items, function (item) {
              var match = false;
              var regex = new RegExp('Robbery', "ig");
              if (regex.test(item.label)) {
                console.log("item = ", item);
                match = true;
              }
              return match;
            });

          return items;
        });

        return templatePicker;
      },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
KarstenRank
Occasional Contributor III

Thank you rscheitlin, but is it also possible without changing the code?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Not that I am aware of.

0 Kudos
RalfWeinreich1
New Contributor

Karsten,

you can also do that in the webmap.

  • Open the webmap in the viewer
  • Start editing 
  • Open the feature-management (manage new features)
  • If necessary add new types
  • At the featuretypes you don't want to see when creating new features remove the templates
    remove template

  • It looks like that
    removed
    • Thats the result
      in the map viewer                                            in the WAB edit widget
      resultin WAB
  • After creating, you can select all types in the popup

If you use ArcGIS Pro you can delete the Symbols from the feature template before sharing the map or layer.

KarstenRank
Occasional Contributor III

Thank you raweipol‌! This is the solution I searched!

0 Kudos