Sure, "fl" would be a reference to a FeatureLayer object to which I'm adding an event listener.It would have been created thusly:var fl:FeatureLayer = _currentEditor.featureLayers[0];
simpsonr, i have the same problem ... i wanna do something like you.. save the user .. but i cant.. im new in flex... i have a question about your solution.. where you place the fl.addEventListener(FeatureLayerEvent.EDITS_STARTING, editsStartingHandler);what is this "fl" can you help me??? Thanks..
As a matter of interest, which login mechanism did you use and where did you hold that information till it was needed at event.adds[0].attributes['EDITEDBY'] = ...
fl.addEventListener(FeatureLayerEvent.EDITS_STARTING, editsStartingHandler); private function editsStartingHandler(event:FeatureLayerEvent):void { if (event.adds) { event.adds[0].attributes['EDITEDBY'] = ... ...
Royce,Modify the attribute of the selected graphic on the Featurelayer's selectioncompleteEvent handler:e.g. protected function incidentsAreas_selectionCompleteHandler(event:FeatureLayerEvent):void { Graphic(event.features[0]).attributes['description'] = "MyDescription" }
Mehul, that worked great. I was able to remove a couple fields from the AttributeInspector using similar method to your example... setting the visible property on the fieldInspectors to false.Now, I'd like to programmatically populate the values of those "hidden" fields of newly created features before they get committed back to the database. What would be your suggestion for doing so?Thanks,-Royce
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:esri="http://www.esri.com/2008/ags" initialize="application1_initializeHandler(event)" pageTitle="Using the Editor component"> <!-- This sample shows you how to use the editor component. --> <s:layout> <s:VerticalLayout/> </s:layout> <fx:Style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx"; @namespace esri "http://www.esri.com/2008/ags"; @namespace components "com.esri.ags.components.*"; @namespace supportClasses "com.esri.ags.components.supportClasses.*"; components|InfoWindow { background-color: #FFFFFF; border-thickness: 2; } </fx:Style> <fx:Script> <![CDATA[ import com.esri.ags.components.AttributeInspector; import com.esri.ags.components.supportClasses.FieldInspector; import component.infoWindow; import mx.events.FlexEvent; protected function application1_initializeHandler(event:FlexEvent):void { myEditor.featureLayers = [ incidentsAreas ]; var fieldInspector1:FieldInspector = new FieldInspector(); fieldInspector1.featureLayer = incidentsAreas; fieldInspector1.fieldName = "description"; fieldInspector1.label="DESCRIPTION" var rendererFactory:ClassFactory = new ClassFactory(MYFieldRenderer); var fieldInspector2:FieldInspector = new FieldInspector(); fieldInspector2.featureLayer = incidentsAreas; fieldInspector2.fieldName = "ftype"; fieldInspector2.label="MyCustomComponent" fieldInspector2.renderer = rendererFactory; var attributeInspector: AttributeInspector = myEditor.attributeInspector; attributeInspector.featureLayers = [incidentsAreas] attributeInspector.fieldInspectors = [fieldInspector2,fieldInspector1] } ]]> </fx:Script> <fx:Declarations> <esri:GeometryService id="myGeometryService" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/> </fx:Declarations> <esri:Map id="myMap"> <esri:extent> <esri:Extent id="socal" xmin="-13471000" ymin="3834000" xmax="-12878000" ymax="4124000"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:FeatureLayer id="incidentsAreas" mode="snapshot" outFields="[ftype,description]" url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/2"/> </esri:Map> <esri:Editor id="myEditor" width="100%" height="200" geometryService="{myGeometryService}" map="{myMap}"/> </s:Application>
<?xml version="1.0" encoding="utf-8"?> <s:HGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:esri="http://www.esri.com/2008/ags" width="100%" height="100%"> <s:Button label="Custom Field Renderer"/> </s:HGroup>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.