Select to view content in your preferred language

Attribute Inspector works only once on featurelayer. why?

652
3
08-20-2019 03:21 AM
AlifShaikh
Emerging Contributor

Hi,

I am working on two feature layers viz. A polygon layer and a point layer. I have configured attribute inspector in order to edit the attributes of the features of both the layers.

When I click on say pointLayer I am doing this and infowindow shows for once. After that, if I click again on any of the two layer's features,I get the image attached after the code. What am I doing wrong?

 BuildingFlayer.on("click", function featureLayerLoaded(svt)
        {
                atInspcForBldg.refresh();
                var selectQuery = new Query();
                selectQuery.distance = 10;
                selectQuery.units = "meters"
                selectQuery.geometry = svt.mapPoint;
                selectQuery.returnGeometry = true;
                BuildingFlayer.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function (features) {
                if (features.length > 0) {
                    //store the current feature
                    updateFeaturebldg = features[0];
                    map.infoWindow.setContent(atInspcForBldg.domNode);
                    map.infoWindow.resize(350, 240);
                    map.infoWindow.setTitle(features[0].getLayer().name);
                    map.infoWindow.show(svt.screenPoint, map.getInfoWindowAnchor(svt.screenPoint));
                }
                else {
                    map.infoWindow.hide();
                }
            });
        });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Regards,

Alif

0 Kudos
3 Replies
AlifShaikh
Emerging Contributor

Robert Scheitlin, GISP‌ can you help?

0 Kudos
imritanshu
Regular Contributor

As I understood below solutions should work for you.

1.  Set Infowindow content outside the click event.

map.infoWindow.setContent(atInspcForBldg.domNode);

2. You can create separate Infowindows for both the layers rather using the defaut map infowindow. It should work in your case. 

Please test above mention solution and let me know if still you face any difficulty.

Regards,

Rhitz

0 Kudos
AlifShaikh
Emerging Contributor

Hey,

map.infoWindow.setContent(atInspcForBldg.domNode);

This did work.

But for Polygon layer I am getting the image attached.

Tried creating infoWindow twice but that did not work.

Regards,

Alif

0 Kudos