[JS API 4.16 Support]
- Dominant language
- CSS
- Stars
- 41
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
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
```js
var featureForm = new FeatureForm({
container: editingNode,
layer: layer,
feature: graphic,
fieldConfig: fieldInfos
});
//editable field change
domConstruct.place("" + this.nls.update + "" + this.nls.delete + "", 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
```js
var featureForm = new FeatureForm({
container: editingNode,
layer: layer,
feature: graphic,
fieldConfig: fieldInfos
});
featureForm._resourcesFetch.then(() => {
domConstruct.place("" + this.nls.update + "" + this.nls.delete + "", 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();
}
}));
}));
});
```
Contributor guide
Assessment
This issue has not been assessed yet.