Select to view content in your preferred language

Setting Popup Location for Point in 4.0

3744
2
Jump to solution
07-06-2016 03:26 PM
LoriEmerson_McCormack
Regular Contributor

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

     });

0 Kudos
1 Solution

Accepted Solutions
FC_Basson
MVP Regular Contributor

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

View solution in original post

2 Replies
FC_Basson
MVP Regular Contributor

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
});
LoriEmerson_McCormack
Regular Contributor

This worked perfectly.  Thanks!

0 Kudos