0

In Edit widget, i modified the RelatedRecordsEditor.js to automatically upload input fields with data like webMapId.

        var mapid=dijit.byId("dijit_form_ValidationTextBox_1").attr("value");
        console.log(mapid);
        var webMapId = this.map.itemInfo.item.id; //this is not working, only in widget.js
        var update = mapid.replace(mapid, webMapId);
        console.log(res);
        dojo.byId('dijit_form_ValidationTextBox_1').value = update;
      }); 

But there is no 'map' declared in this file, only in widget.js. How Can I reach that variable from RelatedRecordsEditor.js? Or how can I declare it? I tried:

define(['esri/map'] function(map)
        var map = this.map;
        console.log(map);
--->undefined

Or how can i use widges.js's map object in this js?

1 Answer 1

1

In RelatedRecordsEditor.js use this._editWidget.map to access the map object from widget.js

See how the this is attributed to _editWidget in the process of intstantiating relatedRecordsEditor in widget.js

// instantiate relatedRecordsEditor in widget.js

  this._relatedRecordsEditor = new RelatedRecordsEditor({
   originalFeature: feature,
   editorATI: this.editor.attributeInspector,
   tableInfosParam: this.layerInfosParamClone.concat(this.tableInfosParamClone),
   nls: lang.mixin(lang.clone(this.nls), window.jimuNls.common),

   // Use this._editWidget to access proporties and methods in the widget.js script from your relatedRecordsEditor.js

   _editWidget: this

            });

This way you can acces the appConfig, config and other properties of the widget.js from other script parts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.