Integer or double field values with Comma in Smart Editor in Webapp builder

1125
8
01-22-2020 07:16 AM
vijaybadugu
Occasional Contributor II

I used formatting in webmap, Smart Editor Json configuration . But it still showing with comma for integer and double field type values .

0 Kudos
8 Replies
vijaybadugu
Occasional Contributor II

Resolved with small code changes

0 Kudos
HeathAnderson
Occasional Contributor II

I am have the same issue.  What code change did you make and where can i find it?

0 Kudos
HeathAnderson
Occasional Contributor II

Hi Vijay,

I hope all is well.  Would you be able to upload screen shots of the changes you made so that I may do the same?

Thank you.

Best,

Heath

0 Kudos
vijaybadugu
Occasional Contributor II

IN showFeature function, Please add Highlighted In Bold below accordingly 


_showFeature: function(b, c) {

n.forEach(d.fieldInfos, function(a) {
m = a.field;

if ((a.type.indexOf("Integer") != -1) || ((a.type.indexOf("Double") != -1) && (a.name=="ID" ))) {
if (a.dijit)
a.dijit.constraints && (a.dijit.constraints.pattern = '#');

0 Kudos
HeathAnderson
Occasional Contributor II

Thank you for your response.  I assume this is the Widget.js file?  What version of WAB are you using?  Again thank you

Best,

Heath

0 Kudos
HeathAnderson
Occasional Contributor II

This is what I was able to find in the Widget.js 

_showFeature: function (b, c) {
   if (b) {
      this._currentFeature =
         b;
      c = c ? c : b.getLayer();
      var e = c.getEditCapabilities({
         feature: b,
         userId: this._userIds[c.id]
      });
      this._canUpdate = e.canUpdate;
      this._canDelete = e.canDelete;
      if (e = this._getLInfoFromFeatureLayer(c)) {
         this._setCurrentLInfo(e);
         var g = b.attributes,
         k = this._findFirst(e.types, "id", g[e.typeIdField]),
         f = null;
         n.forEach(e.fieldInfos, function (b) {
            f = b.field;
            var c = [];
            b.dijit && 1 < b.dijit.length ? n.forEach(b.dijit, function (a) {
               c.push(a)
            }) : c.push(b.dijit);
            n.forEach(c, p.hitch(this, function (b) {
                  if (b) {
                     var c = this._setFieldDomain(b, k, f),
                     e =
                        g[f.name],
                     e = e && c && c.codedValues && c.codedValues.length ? c.codedValues ? c.codedValues.name : e : e;
                     a.isDefined(e) || (e = "");
                     "dijit.form.DateTextBox" === b.declaredClass || "dijit.form.TimeTextBox" === b.declaredClass ? e = "" === e ? null : new Date(e) : "dijit.form.FilteringSelect" ===                      b.declaredClass && (b._lastValueReported = null, e = g[f.name] + "");
                     try {
                        this._setValue(b, e),
                        "dijit.form.FilteringSelect" === b.declaredClass && !1 === b.isValid() && this._setValue(b, null)
                     } catch (la) {
                        b.set("displayedValue", this.NLS_errorInvalid, !1)
                     }
                  }
               }))
            },
               this);
            this._attachmentEditor && e.showAttachments && this._attachmentEditor.showAttachments(this._currentFeature, c);
         (b = c.getEditSummary(b)) ? (this.editorTrackingInfoDiv.innerHTML = b, d.show(this.editorTrackingInfoDiv)) : d.hide(this.editorTrackingInfoDiv)
      }
   }
},

I was unable to locate

n.forEach(d.fieldInfos, function(a) {
m = a.field;

What version of WAB are you using.  I am using 2.8 through Portal.

Thank you,

Best,

Heath

0 Kudos
vijaybadugu
Occasional Contributor II

_showFeature: function (b, c) {
   if (b) {
      this._currentFeature =
         b;
      c = c ? c : b.getLayer();
      var e = c.getEditCapabilities({
         feature: b,
         userId: this._userIds[c.id]
      });
      this._canUpdate = e.canUpdate;
      this._canDelete = e.canDelete;
      if (e = this._getLInfoFromFeatureLayer(c)) {
         this._setCurrentLInfo(e);
         var g = b.attributes,
         k = this._findFirst(e.types, "id", g[e.typeIdField]),
         f = null;
         n.forEach(e.fieldInfos, function (b) {
            f = b.field;
            var c = [];
            b.dijit && 1 < b.dijit.length ? n.forEach(b.dijit, function (a) {
               c.push(a)
            }) : c.push(b.dijit);
            n.forEach(c, p.hitch(this, function (b) {
                  if (b) {
                     var c = this._setFieldDomain(b, k, f),
                     e =
                        g[f.name],
                     e = e && c && c.codedValues && c.codedValues.length ? c.codedValues ? c.codedValues.name : e : e;
                     a.isDefined(e) || (e = "");
                     "dijit.form.DateTextBox" === b.declaredClass || "dijit.form.TimeTextBox" === b.declaredClass ? e = "" === e ? null : new Date(e) : "dijit.form.FilteringSelect" ===                      b.declaredClass && (b._lastValueReported = null, e = g[f.name] + "");
                     try {
                        this._setValue(b, e),
                        "dijit.form.FilteringSelect" === b.declaredClass && !1 === b.isValid() && this._setValue(b, null)
                     } catch (la) {
                        b.set("displayedValue", this.NLS_errorInvalid, !1)
                     }
                  }
               }))
            },
               this);
            this._attachmentEditor && e.showAttachments && this._attachmentEditor.showAttachments(this._currentFeature, c);
         (b = c.getEditSummary(b)) ? (this.editorTrackingInfoDiv.innerHTML = b, d.show(this.editorTrackingInfoDiv)) : d.hide(this.editorTrackingInfoDiv)
      }
   }
},

You can add the code in Highlighted in bold 

0 Kudos
AlixVezina
Esri Regular Contributor

@vijaybadugu This issue should now be resolved in the latest updates of the Smart Editor in ArcGIS Online. The Smart Editor Widget: Two Years in Review - Esri Community

0 Kudos