Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JS API 4.16 Support] #31

Open
AlexanderPoone opened this issue Jul 13, 2020 · 1 comment
Open

[JS API 4.16 Support] #31

AlexanderPoone opened this issue Jul 13, 2020 · 1 comment
Assignees

Comments

@AlexanderPoone
Copy link

AlexanderPoone commented Jul 13, 2020

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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants