Esri / oriented-imagery

Find developer resources for Oriented Imagery, including a Web AppBuilder widget and oriented imagery catalog (OIC) schema.
Apache License 2.0
41 stars 19 forks source link

[JS API 4.16 Support] #31

Open AlexanderPoone opened 4 years ago

AlexanderPoone commented 4 years ago

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();
                            }

                        }));
                    }));
                });
priya4991 commented 4 years ago

@SoftFeta The API is currently based on the 4.15 js api. Updating the widget to 4.16 might cause issues. Please go through the 4.16 release notes.