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

165
7
01-22-2020 07:16 AM
Highlighted
New Contributor III

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

Reply
0 Kudos
7 Replies
Highlighted
New Contributor III

Resolved with small code changes

Reply
0 Kudos
Highlighted
Occasional Contributor

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

Reply
0 Kudos
Highlighted
Occasional Contributor

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

Reply
0 Kudos
Highlighted
New Contributor III

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 = '#');

Reply
0 Kudos
Highlighted
Occasional Contributor

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

Reply
0 Kudos
Highlighted
Occasional Contributor

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

Reply
0 Kudos
Highlighted
New Contributor III

_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 

Reply
0 Kudos