Skip To ContentArcGIS for DevelopersSign In Dashboard
Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample is similar to the Feature widget sample with the exception that this sample demonstrates docking the widget into a side panel. This is useful in circumstances where you may not necessarily want or need the associated feature's information to display directly within the map. It displays information based on the PopupTemplate using the Feature widget. The content of the PopupTemplate is saved within the referenced layer and makes use of custom text elements with chart media.

// Provide graphic and DOM container to a new instance of a Feature widget
const feature = new Feature({
  container:"feature-node",
  graphic: graphic,
  map: view.map,
  spatialReference: view.spatialReference
});

// Listen for the pointer-move event on the View
view.on("pointer-move", function(event) {
  // Perform a hitTest on the View
  view.hitTest(event).then(function(hitTestResult) {
    const result = hitTestResult.results[0];
    highlight && highlight.remove();
    // Update the graphic of the Feature widget
    // on pointer-move with the result
    if (result) {
      feature.graphic = result.graphic;
      highlight = layerView.highlight(result.graphic);
    } else {
      feature.graphic = graphic;
    }
  });
});

Sample search results

TitleSample
Loading...