I have been following this sample to create an popup with edit actions. However when I try to reopen the popup upon successful edits, the popup content is still showing the old value. I used the below code to reopen the popup.
layer.on("edits", e => {
view.openPopup({
features: e.updatedFeatures
})
editor.viewModel.cancelWorkflow();
});
Solved! Go to Solution.
We have something like the code below in our framework, and it works for this purpose:
//This is typically used when the popup's selected feature's attributes have changed, and the popup needs to reflect the new values
function reshowPopup(popup, graphic) {
if (popup.selectedFeature == graphic) {
var selectedFeatureIndex = popup.selectedFeatureIndex;
var features = popup.features.concat([]);
popup.features = features;
popup.selectedFeatureIndex = selectedFeatureIndex;
}
}
We have something like the code below in our framework, and it works for this purpose:
//This is typically used when the popup's selected feature's attributes have changed, and the popup needs to reflect the new values
function reshowPopup(popup, graphic) {
if (popup.selectedFeature == graphic) {
var selectedFeatureIndex = popup.selectedFeatureIndex;
var features = popup.features.concat([]);
popup.features = features;
popup.selectedFeatureIndex = selectedFeatureIndex;
}
}
Hi @JoelBennett , sorry for the late reply. I managed to reopen the popup with the updated attributes with your solution after commenting the fetchFeatures property from the openPopup method. Thanks.
reactiveUtils.when(
() => editor.viewModel.state === "ready",
() => {
// Remove the editor and open the popup again
view.ui.remove(editor);
view.openPopup({
fetchFeatures: true,
shouldFocus: true
});
}
);