AnsweredAssumed Answered

How to update the fieldInfos of the Attribute Editor dynamically

Question asked by kishorekumar146 on Sep 26, 2016

Hi ,

           I am using Editor Widget for editing a feature service.I need to dynamically change the fieldInofs of the Attribute Inspector inside it based on the feature type clicking.After updating the fieldInofs on the click event,when I click the particular feature type for the first time the new fieldInfo is getting updated but when I click another feature type the attribute inspector is not getting updated with the new fieldInfo.Can anyone help me in this regard.

 

Below I am furnishing the code snippet:

var fieldInfos1 = [
                              { 'fieldName': 'sector', 'label': 'sector', 'isEditable': true }
                           ];

var fieldInfos2 = [
                                    { 'fieldName': 'sector', 'label': 'sector', 'isEditable': true },
                                    { 'fieldName': 'assessment', 'label': 'assessment', 'isEditable': true }
                           ];

 

responsePointsFL.on("click", function (evt) {
if (evt.graphic.attributes["activity_t"] == "Aircraft Enemy") {
           var sectorField = responsePoints.fields[5];
           fieldInfos1[0].field = sectorField;
           myEditor.settings.layerInfos[0].fieldInfos = [];
           myEditor.settings.layerInfos[0].fieldInfos=fieldInfos1;
}
else {
          var sectorField = responsePoints.fields[5];
          var asssesmentField = responsePoints.fields[6];
          fieldInfos2[0].field = sectorField;
          fieldInfos2[1].field = asssesmentField;

           myEditor.settings.layerInfos[0].fieldInfos = [];
           myEditor.settings.layerInfos[0].fieldInfos = fieldInfos2;

}

});

 

Regards,

Kishore Kumar

Outcomes