Modify Select Widget WAB

487
2
Jump to solution
11-21-2018 02:32 AM
GarethYoung1
New Contributor III

How do you change the default select option from rectangle to point?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Gareth,

   In the jimu.js\dijit\FeatureSetChooserForMultipleLayers.js Comment out line 63-65

    postCreate:function(){
      this.inherited(arguments);

      this._instances = [];
      this.popupMenu = PopupMenu.getInstance();

      var selectTextDom = query('.select-text', this.domNode)[0];
      selectTextDom.innerHTML = this.nls.select;

      var clearTextDom = query('.clear-text', this.domNode)[0];
      clearTextDom.innerHTML = window.jimuNls.common.clear;

      this._initTooltipDialogs();

      this._initDrawBox();

      this._geoTypeInfos = [];
      this.actions = [];

      if(this.geoTypes.length === 0){
        this.geoTypes.push("EXTENT");
      }

      if(this.geoTypes.length === 1){
        html.addClass(this.domNode, 'single-geotype');
      }else{
        html.addClass(this.domNode, 'multiple-geotypes');
      }

      var validGeoTypes = ['POINT', 'EXTENT', 'POLYGON', 'CIRCLE', 'POLYLINE', 'FREEHAND_POLYGON'];
      var geoTypeMap = {
        POINT: ['icon-select-by-point', this.nls.selectByPoint, this.drawBox.pointIcon],
        EXTENT: ['icon-select-by-rect', this.nls.selectByRectangle, this.drawBox.extentIcon],
        POLYGON: ['icon-select-by-polygon', this.nls.selectByPolygon, this.drawBox.polygonIcon],
        CIRCLE: ['icon-select-by-circle', this.nls.selectByCircle, this.drawBox.circleIcon],
        POLYLINE: ['icon-select-by-line', this.nls.selectByLine, this.drawBox.polylineIcon],
        FREEHAND_POLYGON: ['icon-select-by-freehand-polygon',
          this.nls.selectByFreehandPolygon,
          this.drawBox.freehandPolygonIcon]
      };
      var extentIndex = -1;
      array.forEach(validGeoTypes, lang.hitch(this, function(geoType) {
        var dataItem = geoTypeMap[geoType];
        //var attachpoint = doms[0];
        if (this.geoTypes.indexOf(geoType) >= 0) {
          var geoTypeInfo = {
            geoType: geoType,
            action: {
              iconClass: dataItem[0],
              label: dataItem[1],
              data: {}
            },
            dom: dataItem[2]
          };
          var action = {
            iconClass: dataItem[0],
            label: dataItem[1],
            data: {},
            onExecute: lang.hitch(this, this._onDrawItemClicked, geoTypeInfo)
          };
          this._geoTypeInfos.push(geoTypeInfo);
          this.actions.push(action);
          // if (geoType === 'EXTENT') {
          //   extentIndex = this._geoTypeInfos.length - 1;
          // }
        }
      }));
...

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Gareth,

   In the jimu.js\dijit\FeatureSetChooserForMultipleLayers.js Comment out line 63-65

    postCreate:function(){
      this.inherited(arguments);

      this._instances = [];
      this.popupMenu = PopupMenu.getInstance();

      var selectTextDom = query('.select-text', this.domNode)[0];
      selectTextDom.innerHTML = this.nls.select;

      var clearTextDom = query('.clear-text', this.domNode)[0];
      clearTextDom.innerHTML = window.jimuNls.common.clear;

      this._initTooltipDialogs();

      this._initDrawBox();

      this._geoTypeInfos = [];
      this.actions = [];

      if(this.geoTypes.length === 0){
        this.geoTypes.push("EXTENT");
      }

      if(this.geoTypes.length === 1){
        html.addClass(this.domNode, 'single-geotype');
      }else{
        html.addClass(this.domNode, 'multiple-geotypes');
      }

      var validGeoTypes = ['POINT', 'EXTENT', 'POLYGON', 'CIRCLE', 'POLYLINE', 'FREEHAND_POLYGON'];
      var geoTypeMap = {
        POINT: ['icon-select-by-point', this.nls.selectByPoint, this.drawBox.pointIcon],
        EXTENT: ['icon-select-by-rect', this.nls.selectByRectangle, this.drawBox.extentIcon],
        POLYGON: ['icon-select-by-polygon', this.nls.selectByPolygon, this.drawBox.polygonIcon],
        CIRCLE: ['icon-select-by-circle', this.nls.selectByCircle, this.drawBox.circleIcon],
        POLYLINE: ['icon-select-by-line', this.nls.selectByLine, this.drawBox.polylineIcon],
        FREEHAND_POLYGON: ['icon-select-by-freehand-polygon',
          this.nls.selectByFreehandPolygon,
          this.drawBox.freehandPolygonIcon]
      };
      var extentIndex = -1;
      array.forEach(validGeoTypes, lang.hitch(this, function(geoType) {
        var dataItem = geoTypeMap[geoType];
        //var attachpoint = doms[0];
        if (this.geoTypes.indexOf(geoType) >= 0) {
          var geoTypeInfo = {
            geoType: geoType,
            action: {
              iconClass: dataItem[0],
              label: dataItem[1],
              data: {}
            },
            dom: dataItem[2]
          };
          var action = {
            iconClass: dataItem[0],
            label: dataItem[1],
            data: {},
            onExecute: lang.hitch(this, this._onDrawItemClicked, geoTypeInfo)
          };
          this._geoTypeInfos.push(geoTypeInfo);
          this.actions.push(action);
          // if (geoType === 'EXTENT') {
          //   extentIndex = this._geoTypeInfos.length - 1;
          // }
        }
      }));
...
0 Kudos
GarethYoung1
New Contributor III

Thanks again Robert

0 Kudos