<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using selectedFeature when browsing cluster's features from popup in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1300124#M81417</link>
    <description>&lt;P&gt;I just tried your hack &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt; and it works pretty well.&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 16 Jun 2023 08:41:21 GMT</pubDate>
    <dc:creator>OlivierLefevre</dc:creator>
    <dc:date>2023-06-16T08:41:21Z</dc:date>
    <item>
      <title>Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298606#M81362</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've been trying to mix two functionnalities. One is about displaying attached images in popup. And the other is about clustering.&lt;/P&gt;&lt;P&gt;Most of the code below behaves as expected except for browsing cluster's features.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;meta charset="utf-8" /&amp;gt;
        &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"/&amp;gt;

        &amp;lt;title&amp;gt;Parking clusters&amp;lt;/title&amp;gt;

        &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.26/esri/themes/light/main.css"/&amp;gt;
        
        &amp;lt;style&amp;gt;
            html,
            body,
            #viewDiv {
                padding: 0;
                margin: 0;
                height: 100%;
                width: 100%;
                overflow: hidden;
            }            
        &amp;lt;/style&amp;gt;
        
        &amp;lt;script src="https://js.arcgis.com/4.26/"&amp;gt;&amp;lt;/script&amp;gt;

        &amp;lt;script&amp;gt;
            require([
                "esri/config",
                "esri/portal/Portal",
                "esri/WebMap",
                "esri/views/MapView",
                "esri/widgets/LayerList",
                "esri/widgets/Expand",
                "esri/layers/GroupLayer",
                "esri/smartMapping/labels/clusters",
                "esri/smartMapping/popup/clusters",
                "esri/core/reactiveUtils",
                "esri/symbols/support/symbolUtils",
                "esri/geometry/geometryEngine",
                "esri/Graphic",
                "esri/popup/FieldInfo",
                "esri/popup/ExpressionInfo"
            // Fonction de callback. Attention a passer les constructeurs et les fonctions en arguments dans le même ordre que celui des modules
            ], function(esriConfig, Portal, WebMap, MapView, LayerList, Expand, GroupLayer, clusterLabelCreator, clusterPopupCreator, reactiveUtils, symbolUtils, geometryEngine, Graphic, FieldInfo, ExpressionInfo) {

                let layerAdmHorsCara;
                let basePopupTemplate = [];
                let webmapOperationalLayers;
                let layerServParkingVelo;
                let layerViewServParkingVelo;

                esriConfig.portalUrl = "https://carto.zzzzzzzzzzz.fr/argis";

                const view = new MapView({
                    container: "viewDiv"
                });

                const myPortal = new Portal();

                const webmap = new WebMap({
                    portalItem: {
                        portal: myPortal,
                        id: "xxxyyyxxxyyyxxxyyyxxxyyyxxxyyyxx"
                    }
                });

                const groupLayerVtt = new GroupLayer({
                    title: "VTT",
                    visible: false
                });
                const groupLayerVel = new GroupLayer({
                    title: "Vélo",
                    visible: true
                });
                const groupLayerCor = new GroupLayer({
                    title: "Course d'orientation",
                    visible: false
                });
                const groupLayerEqu = new GroupLayer({
                    title: "Equestre",
                    visible: false
                });
                const groupLayerPed = new GroupLayer({
                    title: "Pédestre",
                    visible: false
                });
                const groupLayerServ = new GroupLayer({
                    title: "Services",
                    visible: false
                });

                webmap.load()
                .then(function() {
                    return webmap.basemap.load();
                })
                .then(function() {
                    const layers = webmap.layers;
                    const promises = layers.map(function(layer) {
                        return layer.load();
                    });
                    return Promise.all(promises.toArray());
                })
                .then(function(layers) {
                    layers.forEach(function(element) {
                        element.title = element.title.slice(4);
                    });
                    return layers;
                })
                .then(function(layers) {
                    webmapOperationalLayers = layers;                    
                    layers.map(function(layer) {
                        if (layer.popupTemplate) {
                            basePopupTemplate[layer.id] = layer.popupTemplate;
                        }
                    });
                    const layerPedCircuit = layers[0];
                    const layerPedEquipement = layers[1];
                    const layerPedBorne = layers[2];
                    const layerEquParcours = layers[3];
                    const layerEquRevetement = layers[4];
                    const layerEquEquipement = layers[5];
                    const layerEquBorne = layers[6];
                    const layerEquAccesParcours = layers[7];
                    const layerCorEquipement = layers[8];
                    const layerCorBorne = layers[9];
                    const layerVttCircuit = layers[10];
                    const layerVttRevetement = layers[11];
                    const layerVttEquipement = layers[12];
                    const layerVttBorne = layers[13];
                    const layerVelCircuit = layers[14];
                    const layerVelEquipement = layers[15];
                    const layerVelBorne = layers[16];
                    layerAdmHorsCara = layers[17];
                    const layerServPiqueNique = layers[18];
                    const layerServEquipVelo = layers[19];
                    const layerServEauPotable = layers[20];
                    const layerServSanitaire = layers[21];
                    layerServParkingVelo = layers[22];
                    layerAdmHorsCara.listMode = "hide";
                    groupLayerVtt.addMany([layerVttCircuit, layerVttRevetement, layerVttEquipement, layerVttBorne]);
                    groupLayerVel.addMany([layerVelCircuit, layerVelEquipement, layerVelBorne]);
                    groupLayerCor.addMany([layerCorEquipement, layerCorBorne]);
                    groupLayerEqu.addMany([layerEquParcours, layerEquRevetement, layerEquEquipement, layerEquBorne, layerEquAccesParcours]);
                    groupLayerPed.addMany([layerPedCircuit, layerPedEquipement, layerPedBorne]);
                    groupLayerServ.addMany([layerServParkingVelo, layerServPiqueNique, layerServEquipVelo, layerServEauPotable, layerServSanitaire]);
                })
                .then(function(){
                    view.map = webmap;
                });

                view.when(function(){
                    webmap.removeAll();
                    webmap.addMany([layerAdmHorsCara, groupLayerPed, groupLayerEqu, groupLayerCor, groupLayerVtt, groupLayerVel, groupLayerServ]);
                })
                .then(function(){
                    const layerList = new LayerList({
                        container: document.createElement("llDiv"),
                        view: view,
                        selectionEnabled: false,
                        listItemCreatedFunction: function(event) {
                            const item = event.item;
                            if (item.layer.type != "group") { // don't show legend twice
                                item.panel = {
                                    content: "legend",
                                    open: false,
                                };
                            }                           
                        }
                    });
                    
                    // Builds popup template for layers with attachments to be displayed in popup
                    function buildLayerPopupTemplate(f_objectId, layer) {
                        layer.queryAttachments({
                                attachmentTypes: ["image/jpeg", "image/png"],
                                objectIds: f_objectId
                        })
                        .then(function(attachmentsByFeatureId) {
                            if (!attachmentsByFeatureId) {
                                return;
                            }
                            
                            if (["Parking_velo", "Pique-nique"].includes(layer.title)) {
                                let template = {title:basePopupTemplate[layer.id].title};
                            
                                let content = [{
                                    type: "fields",
                                    fieldInfos: basePopupTemplate[layer.id].fieldInfos
                                }];
                                
                                // If there are attached images
                                if (Object.keys(attachmentsByFeatureId).length &amp;gt; 0){
                                    const attachments = Object.values(attachmentsByFeatureId)[0];
                                    let mediaInfos =  [];
                                    if (attachments) {
                                        attachments.forEach(function (attachment) {
                                            const image_url = attachment.url;
                                            const item = {
                                                type: "image",
                                                value: {
                                                    sourceURL:image_url,
                                                    linkURL: image_url
                                                }
                                            }
                                            mediaInfos.push(item);
                                        });
                                        
                                        let typeMedia = {
                                            type: "media",
                                        }
                                        typeMedia.mediaInfos = mediaInfos;
                                        content.push(typeMedia);
                                    }
                                };
                                
                                template.content = content;
                                layer.popupTemplate = template;
                            }
                        })
                        .catch(function(error) {
                            console.log(error)
                        });
                    }

                    view.on("click", function(event) {                 
                        const opts = {
                            include: webmapOperationalLayers.filter(layer =&amp;gt; {
                                return layer.type === "feature"
                            })
                        }
                        view.hitTest(event, opts)
                        .then(function (response) {
                            if (response.results.length) {
                                let graphic = response.results[0].graphic;
                                if (!graphic.attributes.objectid) {
                                    return;
                                }
                                buildLayerPopupTemplate(graphic.attributes.objectid, graphic.layer);
                            }
                        })
                        .catch(function(error) {
                            console.log(error)
                        });
                    });

                    layerServParkingVelo.when()
                    .then(generateClusterConfig)
                    .then(async (featureReduction) =&amp;gt; {
                        // sets generated cluster configuration on the layer
                        layerServParkingVelo.featureReduction = featureReduction;
                        // the layer view is needed for querying clusters
                        layerViewServParkingVelo = await view.whenLayerView(layerServParkingVelo);
                    })
                    .catch((error) =&amp;gt; {
                        console.error(error);
                    });
                
                    async function generateClusterConfig(layer) {
                        // generates default popupTemplate
                        const popupTemplate = await clusterPopupCreator
                        .getTemplates({
                            layer
                        })
                        .then(
                        (popupTemplateResponse) =&amp;gt;
                            popupTemplateResponse.primaryTemplate.value
                        );
                
                        // Add actions for exploring the features of each cluster
                        popupTemplate.actions = [
                          {
                            title: "Convex hull",
                            id: "convex-hull",
                            className: "esri-icon-polygon"
                          },
                          {
                            title: "Show features",
                            id: "show-features",
                            className: "esri-icon-maps"
                          }
                        ];

                        popupTemplate.title = "Groupe de {cluster_count} parkings vélo";
                        
                        const clusterSumExpressionInfo = new ExpressionInfo({
                            name: "cluster-sum",
                            title: "somme des places",
                            expression: `
                                Expects($aggregatedFeatures, 'nombre_place')
                                Text(Sum($aggregatedFeatures, 'nombre_place'), '#,###')
                            `
                            //returnType: "string"
                        })
                        popupTemplate.expressionInfos.push(clusterSumExpressionInfo)

                        popupTemplate.content = [{
                                type: "text",
                                text: "Cela représente {expression/cluster-sum} places au total."                    
                            }, {
                                type: "text",
                                text: "Un zoom avant affichera plus en détail la localisation des parkings."
                            }
                        ]

                        // generates default labelingInfo
                        const { labelingInfo, clusterMinSize } = await clusterLabelCreator
                        .getLabelSchemes({
                            layer,
                            view
                        })
                        .then((labelSchemes) =&amp;gt; labelSchemes.primaryScheme);

                        labelingInfo[0].symbol.color = "rgba(0, 112, 255, 0.8)";
                        labelingInfo[0].symbol.haloSize = 0;

                        const clusterSymbol = {
                            type: "simple-marker",
                            style: "circle",
                            color: "rgba(255, 255, 255, 0.8)",
                            outline: {
                                color: "rgba(0, 112, 255, 0.8)",
                                width: 2
                            }
                        }

                        const clusterMaxSize = 40;
                        const clusterRadius = 80;

                        return {
                            type: "cluster",
                            popupTemplate,
                            labelingInfo,
                            clusterMinSize,
                            clusterMaxSize: clusterMaxSize,
                            clusterRadius: clusterRadius,
                            maxScale: 5000,
                            symbol: clusterSymbol
                        };
                    }

                    view.popup.on("trigger-action", (event) =&amp;gt; {
                        clearViewGraphics();
                        const id = event.action.id;
                        if (id === "convex-hull") {
                          displayConvexHull(view.popup.selectedFeature);
                        }
                        if (id === "show-features") {
                          displayFeatures(view.popup.selectedFeature);
                        }
                    });
              
                    reactiveUtils.watch(
                        () =&amp;gt; [view.scale, view.popup.selectedFeature, view.popup.visible],
                        ([scale, selectedFeature, visible]) =&amp;gt; {
                            clearViewGraphics()
                            if (selectedFeature) {
                                if (!selectedFeature.isAggregate) {
                                    buildLayerPopupTemplate(selectedFeature.attributes.objectid, selectedFeature.layer);
                                }
                            }
                        }
                    );
              
                    let convexHullGraphic = null;
                    let clusterChildGraphics = [];
              
                    function clearViewGraphics() {
                        view.graphics.remove(convexHullGraphic);
                        view.graphics.removeMany(clusterChildGraphics);
                    }

                    // displays all features from a given cluster in the view
                    async function displayFeatures(graphic) {
                        processParams(graphic, layerViewServParkingVelo);

                        const query = layerViewServParkingVelo.createQuery();
                        query.aggregateIds = [graphic.getObjectId()];
                        const { features } = await layerViewServParkingVelo.queryFeatures(query);

                        features.forEach(async (feature) =&amp;gt; {
                            const symbol = await symbolUtils.getDisplayedSymbol(feature);
                            feature.symbol = symbol;
                            view.graphics.add(feature);
                        });
                        clusterChildGraphics = features;
                    }

                    async function displayConvexHull(graphic) {
                        processParams(graphic, layerViewServParkingVelo);

                        const query = layerViewServParkingVelo.createQuery();
                        query.aggregateIds = [graphic.getObjectId()];
                        const { features } = await layerViewServParkingVelo.queryFeatures(query);
                        const geometries = features.map((feature) =&amp;gt; feature.geometry);
                        const [convexHull] = geometryEngine.convexHull(geometries, true);

                        convexHullGraphic = new Graphic({
                            geometry: convexHull,
                            symbol: {
                                type: "simple-fill",
                                outline: {
                                    width: 1.5,
                                    color: [75, 75, 75, 1]
                                },
                                style: "none",
                                color: [0, 0, 0, 0.1]
                            }
                        });
                        view.graphics.add(convexHullGraphic);
                    }

                    function processParams(graphic, layerView) {
                        if (!graphic || !layerView) {
                            throw new Error("Graphic or layerView not provided.");
                        }
              
                        if (!graphic.isAggregate) {
                            throw new Error("Graphic must represent a cluster.");
                        }
                    }

                    const layerListExpand = new Expand({
                        expandIconClass: "esri-icon-layer-list",
                        expandTooltip: "Légende",
                        collapseTooltip: "Replier la légende",
                        view: view,
                        content: layerList.domNode,
                        group: "top-right",
                        expanded: true
                    });

                    view.ui.add([layerListExpand], "bottom-right");
                });
            });
        &amp;lt;/script&amp;gt;

    &amp;lt;/head&amp;gt;

    &amp;lt;body&amp;gt;
        &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When browsing clicked features (forward and backward) everything is fine.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="browsing clicked features" style="width: 227px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73047iBE727C3D3B92E734/image-size/medium?v=v2&amp;amp;px=400" role="button" title="browsing clicked features.jpg" alt="browsing clicked features" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;browsing clicked features&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Browsing forward cluster's features is fine too. But an error occurs when browsing those features backward.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="browsing cluster's features" style="width: 172px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73048i717030F632BEE53A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="browsing_cluster_features.jpg" alt="browsing cluster's features" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;browsing cluster's features&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;At line 355 &lt;STRONG&gt;selectedFeature.layer&lt;/STRONG&gt; is null.&lt;/P&gt;&lt;P&gt;I don't understand why and how to fix this issue.&lt;/P&gt;&lt;P&gt;Could you please help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 13:44:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298606#M81362</guid>
      <dc:creator>OlivierLefevre</dc:creator>
      <dc:date>2023-06-26T13:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298780#M81373</link>
      <description>&lt;P&gt;This is a bug in the API, particularly the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup-PopupViewModel.html" target="_self"&gt;PopupViewModel&lt;/A&gt;, which I'll try to summarize here, and then provide recommendations.&lt;/P&gt;&lt;P&gt;Basically, the PopupViewModel stores a reference to all the features in the vicinity that you clicked on the map.&amp;nbsp; When clicking on a cluster, you can browse the cluster's features as shown in your screenshots.&amp;nbsp; When you click the next button, it takes that corresponding feature's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html" target="_self"&gt;Graphic&lt;/A&gt; reference and adds it to the MapView's &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#graphics" target="_self"&gt;graphics&lt;/A&gt; collection, thus enabling you to temporarily see that particular feature on the map (i.e. in addition to the cluster graphic).&amp;nbsp; If you click next again, it removes the current Graphic, and then adds the newly selected feature's Graphic.&amp;nbsp; It is this adding and removing from the MapView's graphics that causes the Graphics'&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#layer" target="_self"&gt;layer&lt;/A&gt; property to get severed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My recommendation for you&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;There are various ways to work around this,, and all will fall under the category of a hack.&amp;nbsp; My recommendation is to apply the simplest one, and replace the reference to "layer" with the undocumented property "sourceLayer" like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;buildLayerPopupTemplate(selectedFeature.attributes.objectid, selectedFeature.sourceLayer);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can change this back if it ever gets fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My recommendation for ESRI&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;Since we have to wait three and a half weeks to download 4.27, I'm still looking at 4.26.&amp;nbsp; The problem occurs in the PopupViewModel module, particularly in the "_selectedFeatureChange" function.&amp;nbsp; When setting the "_selectedClusterFeature" property, this can be resolved by setting it to a clone of the graphic, rather than the graphic itself.&amp;nbsp; That is, replace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._selectedClusterFeature=b&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this._selectedClusterFeature=b.clone()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 23:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298780#M81373</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-13T23:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298788#M81374</link>
      <description>&lt;P&gt;I have replied twice to this with a solution and my posts keep getting deleted almost immediately.&amp;nbsp; Did you see either of those before they disappeared?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 19:15:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298788#M81374</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-13T19:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298818#M81377</link>
      <description>&lt;P&gt;I've not seen anything.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 19:38:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298818#M81377</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2023-06-13T19:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298841#M81381</link>
      <description>&lt;P&gt;The third attempt seems to have worked; good thing I made a backup of the second attempt...&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 19:53:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298841#M81381</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-13T19:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298852#M81382</link>
      <description>&lt;P&gt;Haha, nope! I still don't see it. Maybe try contacting the &lt;A href="mailto:esricommunity@esri.com" target="_self"&gt;community team&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 19:57:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298852#M81382</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2023-06-13T19:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298869#M81383</link>
      <description>&lt;P&gt;Sure enough, it disappeared...I took a screenshot last time; maybe just posting that will work.&amp;nbsp; Here goes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="image.png" style="width: 966px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/73121iD147408849EB926A/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 20:03:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298869#M81383</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2023-06-13T20:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298957#M81386</link>
      <description>&lt;P&gt;Apologies on that, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;Our automated spam filter isn't always as smart as it thinks it is and can occasionally make a mistake in what it quarantines for our team's review.&lt;/P&gt;
&lt;P&gt;I've released your comment to this thread so that it's now public again.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 22:24:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1298957#M81386</guid>
      <dc:creator>BriannaEttley</dc:creator>
      <dc:date>2023-06-13T22:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1300124#M81417</link>
      <description>&lt;P&gt;I just tried your hack &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt; and it works pretty well.&lt;/P&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Jun 2023 08:41:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1300124#M81417</guid>
      <dc:creator>OlivierLefevre</dc:creator>
      <dc:date>2023-06-16T08:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1301780#M81461</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/23755"&gt;@OlivierLefevre&lt;/a&gt;&amp;nbsp;-&lt;/P&gt;&lt;P&gt;I haven't been able to reproduce the issue you're experiencing with any of our &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster/" target="_self"&gt;clustering samples&lt;/A&gt;. We'd like to look into this issue. Would you be able to send over a CodePen with a simplified sample and let us know what type of data is in your webmap (e.g. feature, map image, etc.)?&lt;/P&gt;&lt;P&gt;Accessing the selectedFeature's layer for MapImageLayers does not work because the layer property is not exposed for graphics from a MapImageLayer. It doesn't seem like your data is from a map image service since you're checking for the "feature" type, but I would like to make sure that's not the case. I haven't seen this issue before with clustering so any extra information you can provide would be helpful!&lt;/P&gt;&lt;P&gt;Just note the sourceLayer property isn't an officially documented property so this might not always work.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 22:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1301780#M81461</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2023-06-21T22:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302276#M81485</link>
      <description>&lt;P&gt;This can be reproduced in the &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/featurereduction-cluster/" target="_self"&gt;Intro to Clustering&lt;/A&gt; sample:&lt;/P&gt;&lt;P&gt;1. Go to the "Intro to Clustering" sample &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=featurereduction-cluster" target="_self"&gt;sandbox&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;2. Add the following code between lines 169 and 170 (i.e. somewhere between the instantiation of the View and the instantiation of the Legend):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        require(["esri/core/reactiveUtils"], function(reactiveUtils) {
          reactiveUtils.watch(
            () =&amp;gt; view.popup?.selectedFeature,
            (selectedFeature) =&amp;gt; {
              if ((selectedFeature) &amp;amp;&amp;amp; (!selectedFeature.layer)) alert("no layer");
            }
          );
        });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Click "Refresh" above the top right of the map.&lt;/P&gt;&lt;P&gt;4. After the map loads, click a cluster.&lt;/P&gt;&lt;P&gt;5. On the popup, click "Browse features".&lt;/P&gt;&lt;P&gt;6. Click the "Next feature" icon.&lt;/P&gt;&lt;P&gt;7. Click the "Next feature" icon again.&lt;/P&gt;&lt;P&gt;8. Click the "Previous feature" icon - the alert displays, showing that the feature's "layer" reference has been lost.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2024 00:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302276#M81485</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-03-29T00:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302316#M81487</link>
      <description>&lt;P&gt;Thank you for providing this! I was expecting the popup to not show the previous feature as depicted in the images above, but that doesn't seem to be the case:&amp;nbsp;&lt;A href="https://codepen.io/laurenb14/pen/JjebjQN" target="_blank" rel="noopener"&gt;https://codepen.io/laurenb14/pen/JjebjQN&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The main issue is that the selectedFeature's layer reference is lost. We will take a look at this and get back to this post!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2023 00:48:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302316#M81487</guid>
      <dc:creator>LaurenBoyd</dc:creator>
      <dc:date>2023-06-23T00:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using selectedFeature when browsing cluster's features from popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302986#M81525</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/400217"&gt;@LaurenBoyd&lt;/a&gt; for your interest in this issue.&lt;/P&gt;&lt;P&gt;I am sorry not to have been able to get back to you sooner as I was off last week.&lt;/P&gt;&lt;P&gt;Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt; for the extra information you provided LaurenBoyd with.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 13:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/using-selectedfeature-when-browsing-cluster-s/m-p/1302986#M81525</guid>
      <dc:creator>OlivierLefevre</dc:creator>
      <dc:date>2023-06-26T13:55:27Z</dc:date>
    </item>
  </channel>
</rss>

