In JavaScript API 4.16, the constructor of FeatureForm becomes asynchronous.
As FeatureForm has to load data from ArcGIS Online, its creation is slower than the creation of Update & Delete buttons.
I changed
var featureForm = new FeatureForm({
container: editingNode,
layer: layer,
feature: graphic,
fieldConfig: fieldInfos
});
//editable field change
domConstruct.place("<button class='btn btn-clear'>" + this.nls.update + "</button><button class='btn btn-clear' style='margin-left:10px;'>" + this.nls.delete + "</button>", featureForm.container);
console.log(featureForm.container);
featureForm.container.childNodes[1].addEventListener("click", lang.hitch(this, function () {
if (featureForm)
featureForm.submit();
}));
featureForm.container.childNodes[2].addEventListener("click", lang.hitch(this, function () {
layer.applyEdits({ deleteFeatures: [{ objectId: objectId }] }).then(lang.hitch(this, function (result) {
if (result.deleteFeatureResults.length) {
this.orientedViewer.refreshVectorLayer(layer.title);
this.sceneView.popup.clear();
this.sceneView.popup.close();
}
}));
}));
to
var featureForm = new FeatureForm({
container: editingNode,
layer: layer,
feature: graphic,
fieldConfig: fieldInfos
});
featureForm._resourcesFetch.then(() => {
domConstruct.place("<button class='btn btn-clear'>" + this.nls.update + "</button><button class='btn btn-clear' style='margin-left:10px;'>" + this.nls.delete + "</button>", featureForm.container, "last");
console.log(featureForm.container);
featureForm.container.childNodes[1].addEventListener("click", lang.hitch(this, function () {
if (featureForm)
featureForm.submit();
}));
featureForm.container.childNodes[2].addEventListener("click", lang.hitch(this, function () {
layer.applyEdits({ deleteFeatures: [{ objectId: objectId }] }).then(lang.hitch(this, function (result) {
if (result.deleteFeatureResults.length) {
this.orientedViewer.refreshVectorLayer(layer.title);
this.sceneView.popup.clear();
this.sceneView.popup.close();
}
}));
}));
});
In JavaScript API 4.16, the constructor of
FeatureForm
becomes asynchronous. As FeatureForm has to load data from ArcGIS Online, its creation is slower than the creation ofUpdate
&Delete
buttons.I changed
to