I am using the sample called "Query features from a FeatureLayerView" in the JavaScript 4.0 API and am using a point feature layer rather than a polygon. How do I set the location for the Popup Location?
There are two problems with what I have tried: 1. When I click on a list-item in the right pane, the popup doesn't display, unless I click on a feature first to bring up the popup. Then as I go through the list-items, the popup content will change. 2. The location of the popup won't change when I am clicking list-items in the right pane. The location of the popup does change when I click on the individual features on the map.
This is what I have tried:
if (result) {
view.popup.open({
features: [result],
location: evt.mapPoint
});
Solved! Go to Solution.
The popup position in the sample has to do with the docking options for mobile device views [Popup | API Reference | ArcGIS API for JavaScript 4.0 ].
To set the popup not to dock at the click of the item, set the following popup properties in the MapView object:
popup: { dockEnabled: false, dockOptions: { // Disables the dock button from the popup buttonEnabled: true, // Ignore the default sizes that trigger responsive docking breakpoint: false } }
For the popup to open at the Point feature location:
view.popup.open({ features: [result], location: result.geometry });
The popup position in the sample has to do with the docking options for mobile device views [Popup | API Reference | ArcGIS API for JavaScript 4.0 ].
To set the popup not to dock at the click of the item, set the following popup properties in the MapView object:
popup: { dockEnabled: false, dockOptions: { // Disables the dock button from the popup buttonEnabled: true, // Ignore the default sizes that trigger responsive docking breakpoint: false } }
For the popup to open at the Point feature location:
view.popup.open({ features: [result], location: result.geometry });
This worked perfectly. Thanks!