Select to view content in your preferred language

attachment inspector sample modification issue

719
7
07-02-2010 10:23 AM
SimonMorgan
Frequent Contributor
I am attempting to change the attribute inspector sample to point to my day. I changed it to point to a point layer (which is in SDE AND published as a feature server), I click on the point and nothing happens. It does not get selected, the attribute editor window does nto pop. The portion I modified is below:

<fx:Declarations>
        <esri:Query id="queryMapClick"/>
        <esri:Extent id="initialExtent"
                     xmin="-93.885" ymin="45.164" xmax="-93.131" ymax="44.791">
            <esri:SpatialReference wkid="4326"/>

        </esri:Extent>
    </fx:Declarations>

    <s:layout>
        <s:VerticalLayout/>
    </s:layout>

    <s:Label fontSize="13"
             fontWeight="bold"
             paddingLeft="5"
             paddingTop="5"
             text="Click on any Kiosk or Sign to see, and modify, its attributes."/>
    <esri:Map id="myMap"
              initialize="myMap.extent = WebMercatorUtil.geographicToWebMercator(initialExtent) as Extent"
              load="attrInsp.featureLayers = [myFeatureLayer]"
              mapClick="map_mapClickHandler(event)"
              openHandCursorVisible="false">

        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>

        <esri:ArcGISDynamicMapServiceLayer id="opsLayer" url="http://[SERVERNAME]/ArcGIS/rest/services/FLEX2_kiosks/MapServer"/>
        <esri:FeatureLayer id="myFeatureLayer"
                           mode="selection"
                           outFields="
  • "

  •                            selectionComplete="myFeatureLayer_selectionCompleteHandler(event)"
                               url="http://[SERVERNAME]/ArcGIS/rest/services/FLEX2_kiosks/FeatureServer/0"
                               />
                              
            <esri:infoWindowContent>
                <mx:VBox backgroundColor="0xFFFFFF">
                    <esri:AttributeInspector id="attrInsp"
                                             deleteFeature="attrInsp_deleteFeatureHandler(event)"
                                             updateFeature="attrInsp_updateFeatureHandler(event)">


                      
                    </esri:AttributeInspector>
                </mx:VBox>
            </esri:infoWindowContent>
        </esri:Map>
        <s:HGroup horizontalCenter="0" width="100%">
            <s:Label text="The feature layer have {myFeatureLayer.selectedFeatures.length} selected feature."/>
        </s:HGroup>
        <s:HGroup horizontalCenter="0" width="100%">
            <s:Label id="status"/>
        </s:HGroup>
    </s:Application>
    Tags (2)
    0 Kudos
    7 Replies
    SimonMorgan
    Frequent Contributor
    I got it to work with polygons to the point where I can click on a polygon and have the attribute editor pop up, but when I make a change I get the following:

    An unexpected error occurred processing the request.

    I have tried ti with and without the following field inspector code:

    <esri:FieldInspector featureLayer="{myFeatureLayer}"
                                             fieldName="Comments"
                                             label="Comments"/>

    Does the attribute inspector work with points?
    0 Kudos
    DasaPaddock
    Esri Regular Contributor
    Yes, the attribute inspector works with all geometry types. Can you use a tool like Charles Proxy or HttpFox to see what the request was that gave the error?
    0 Kudos
    SimonMorgan
    Frequent Contributor
    Yes, the attribute inspector works with all geometry types. Can you use a tool like Charles Proxy or HttpFox to see what the request was that gave the error?


    I altered my services to be in their native form and changed the sample as below, but now data does not even display.

    <fx:Declarations>
            <esri:Query id="queryMapClick"/>
            <esri:Extent id="initialExtent"
                         xmin="405988.370168365" ymin="4943932.30546446" xmax="515756.580441262" ymax="5009412.68433616">
                <esri:SpatialReference wkid="26915"/>

            </esri:Extent>
        </fx:Declarations>

        <s:layout>
            <s:VerticalLayout/>
        </s:layout>

        <s:Label fontSize="13"
                 fontWeight="bold"
                 paddingLeft="5"
                 paddingTop="5"
                 text="Click on any Kiosk or Sign (26915/new extent) to see, and modify, its attributes."/>
        <esri:Map id="myMap"
                  initialize="myMap.extent = WebMercatorUtil.geographicToWebMercator(initialExtent) as Extent"
                  load="attrInsp.featureLayers = [myFeatureLayer]"
                  mapClick="map_mapClickHandler(event)"
                  openHandCursorVisible="false">

            <esri:ArcGISDynamicMapServiceLayer url="http://gis-web/ArcGIS/rest/services/Staff_App/STAFF_basemap/MapServer"/>

            <esri:ArcGISDynamicMapServiceLayer id="opsLayer" url="http://gis-web/ArcGIS/rest/services/EDITING_kioskcollection/MapServer"/>
            <esri:FeatureLayer id="myFeatureLayer"
                               mode="selection"
                               outFields="
  • "

  •                            selectionComplete="myFeatureLayer_selectionCompleteHandler(event)"
                               url="http://gis-web/ArcGIS/rest/services/EDITING_kioskcollection/FeatureServer/0"
                               />
                              
            <esri:infoWindowContent>
                <mx:VBox backgroundColor="0xFFFFFF">
                    <esri:AttributeInspector id="attrInsp"
                                             deleteFeature="attrInsp_deleteFeatureHandler(event)"
                                             updateFeature="attrInsp_updateFeatureHandler(event)">
        
         <esri:FieldInspector featureLayer="{myFeatureLayer}"
                                             fieldName="Comments"
                                             label="Comments"/>


                      
                    </esri:AttributeInspector>
                </mx:VBox>
            </esri:infoWindowContent>
        </esri:Map>
        <s:HGroup horizontalCenter="0" width="100%">
            <s:Label text="The feature layer have {myFeatureLayer.selectedFeatures.length} selected feature."/>
        </s:HGroup>
        <s:HGroup horizontalCenter="0" width="100%">
            <s:Label id="status"/>
        </s:HGroup>
    </s:Application>
    0 Kudos
    SimonMorgan
    Frequent Contributor
    Per my previous post, it was a simple coordinate system issue, silly mistake. But I still cannot click on a point to modify its attributes.
    0 Kudos
    SimonMorgan
    Frequent Contributor
    I have run charles proxy, what I am I looking for?
    0 Kudos
    DasaPaddock
    Esri Regular Contributor
    Do you see any requests going to your service and are there any errors in the responses?

    Can you post the full source to your app?
    0 Kudos
    CharlesHarris
    Emerging Contributor
    I was having this issue recently also but with the Attribute Inspector.  I changed the click query to give me a tolerable extent by using the click query syntax from the "Related Records" sample under FeatureLayer samples.  It seems as though the probability of actually clicking on an infinity small point is very low (A bit of humor there). 

    Here is the bit of code that I used to enable me to click a point and display the Attribute Inspector...

      var tol:Number = myMap.extent.width / myMap.width * 5;
      var x:Number = event.mapPoint.x;
      var y:Number = event.mapPoint.y;
      var queryExtent:Extent = new Extent(x - tol, y - tol, x + tol, y + tol);
        
      var thisSelectionQuery:Query = new Query();
      thisSelectionQuery.geometry = queryExtent;
      myFeatureLayer.selectFeatures(thisSelectionQuery, FeatureLayer.SELECTION_NEW);

    Maybe this will help
    0 Kudos