Select to view content in your preferred language

FeatureLayer - compact build - tap events

1957
12
10-18-2011 02:58 PM
GadyPitaru
Emerging Contributor
I am developing an app with the JavaScript API on a mobile website. I'm using the compact build of version 2.5, and I'm having trouble with click/tap events registering on a FeatureLayer to display the InfoWindow with attributes of the clicked graphic. It works fine in the browser, just not when using a mobile device. Any help is much appreciated, here is my code for adding the FeatureLayer to the map:

            var template = new esri.InfoTemplate("<b>${DESCRIPTION}</b>", getTextContent);

            var featureLayer = new esri.layers.FeatureLayer("http://m.skyharbor.com/mapservice/0", {
                mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
                infoTemplate: template,
                outFields: ["DESCRIPTION","Type"],
                opacity: 0
            });
            map.addLayer(featureLayer);
12 Replies
samuelxu
Deactivated User
Kelly,
    Your page does work much better on Android.
    But I think for yours, the click event is bind to the graphic layer.
    In my case, I bind the click event to map as I want to displaly mutiple feature identify results in mobile popup, and also for performance issue, I don't want to bring back all the attributes in the feature layers.  So in my code, it uses
   dojo.connect(map,"onClick",executeIdentifyTask);
   
    My application is just like ESRI Sample http://help.arcgis.com/en/webapi/javascript/arcgis/demos/mobile/mobile_arcgis.html   But this sample not works well on Android when clicking on the map.

    I am using ESRI JS API with JQuerymobile.  Is there anyway to use jQueryMobile's vClick or Tab events for this.  I tried some thing like below, but they don't work as expected.
     dojo.connect(map,"vClick",executeIdentifyTask);
     or
       dojo.connect(map,"tap",executeIdentifyTask);
    

   Thanks!
0 Kudos
KellyHutchins
Esri Notable Contributor
I just ran a quick test on the Android using this developer sample and it worked ok for me:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_popup.htm...

One thing you might try is to increase the IdentifyParameters tolerance. The tolerance defines the distances from the input geometry (mouse click)  that should be used to perform the identify.

   identifyParams = new esri.tasks.IdentifyParameters();
   identifyParams.tolerance = 3;
   identifyParams.returnGeometry = true;

0 Kudos
GadyPitaru
Emerging Contributor
So I tested this further, and it turns out that setting the opacity value to 0 on the FeatureLayer was the culprit, although the issue only occurrs on Android and not iPhone.
0 Kudos