<?xml version="1.0" ?> <!-- If compiling this widget, make sure to add -keep-all-type-selectors=true to your compiler arguments in the FB project properties. --> <configuration> <createoptions> <polygondrawtools>polygon,freehandpolygon,extent,autocomplete </polygondrawtools> <polylinedrawtools>polyline,freehandpolyline,line</polylinedrawtools> </createoptions> <addfeatures>true</addfeatures> <deletefeatures>true</deletefeatures> <toolbarvisible>true</toolbarvisible> <toolbarcutvisible>true</toolbarcutvisible> <toolbarmergevisible>true</toolbarmergevisible> <toolbarreshapevisible>true</toolbarreshapevisible> <updategeometry>true</updategeometry> <updateattributes>true</updateattributes> <layersettings> <layer name="Active Incident Areas"> <fields> <field name="TYPE" alias="Type" /> <field name="DESCRIPTION" alias="Description" /> <field name="STATUS" alias="Status" /> <field name="START_DATE" alias="Start" /> <field name="END_DATE" alias="End" /> </fields> <showobjectid>false</showobjectid> <showglobalid>false</showglobalid> <singletomultilinethreshold>60</singletomultilinethreshold> <formfieldsorder>fields</formfieldsorder> </layer> </layersettings> </configuration>
Solved! Go to Solution.
private function attributeInspector_showFeatureHandler(event:AttributeInspectorEvent):void { attachmentInspector.addEnabled = editor.attributeInspector.updateEnabled; attachmentInspector.deleteEnabled = editor.attributeInspector.deleteButtonVisible; const featureLayer:FeatureLayer = event.featureLayer; var settingsKey:String = featureLayer.name; if (featureLayer.name.indexOf("hiddenLayer_") != -1) { settingsKey = hiddenFeatureLayerToSettingsName[featureLayer]; if (!settingsKey) { settingsKey = featureLayerToDynamicMapService[featureLayer].name + "/" + featureLayer.url.substring(featureLayer.url.lastIndexOf("/") + 1, featureLayer.url.length); hiddenFeatureLayerToSettingsName[featureLayer] = settingsKey; } } var settingsObject:Object = layerToSettings[settingsKey]; if (settingsObject) { var outFields:Array = settingsObject.outFields as Array; if (outFields && outFields.length) { var attributeInspectorFieldInspectors:Array = []; var fieldInspector:FieldInspector; for each (var fieldObject:Object in outFields) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = true; fieldInspector.fieldName = fieldObject.name; fieldInspector.label = fieldObject.alias; fieldInspector.toolTip = fieldObject.tooltip; attributeInspectorFieldInspectors.push(fieldInspector); } for each (var field:Field in featureLayer.layerDetails.fields) { if (outFields.indexOf(field.name) == -1) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = false; fieldInspector.fieldName = field.name; attributeInspectorFieldInspectors.push(fieldInspector); } } editor.attributeInspector.fieldInspectors = attributeInspectorFieldInspectors; editor.attributeInspector.formFieldsOrder = AttributeInspector.FIELD_INSPECTOR_ORDER; } else { var formFieldsOrder:String = settingsObject.formFieldsOrder; if (formFieldsOrder) { editor.attributeInspector.formFieldsOrder = formFieldsOrder; } } var singleToMultilineThreshold:Number = settingsObject.singleToMultilineThreshold; if (singleToMultilineThreshold && !isNaN(singleToMultilineThreshold)) { editor.attributeInspector.singleToMultilineThreshold = singleToMultilineThreshold; } var showObjectID:String = settingsObject.showObjectID; if (showObjectID) { editor.attributeInspector.showObjectID = showObjectID == "true"; } var showGlobalID:String = settingsObject.showGlobalID; if (showGlobalID) { editor.attributeInspector.showGlobalID = showGlobalID == "true"; } } } private function attributeInspector_showFeatureHandler(event:AttributeInspectorEvent):void { attachmentInspector.addEnabled = editor.attributeInspector.updateEnabled; attachmentInspector.deleteEnabled = editor.attributeInspector.deleteButtonVisible; const featureLayer:FeatureLayer = event.featureLayer; var settingsKey:String = featureLayer.name; if (featureLayer.name.indexOf("hiddenLayer_") != -1) { settingsKey = hiddenFeatureLayerToSettingsName[featureLayer]; if (!settingsKey) { settingsKey = featureLayerToDynamicMapService[featureLayer].name + "/" + featureLayer.url.substring(featureLayer.url.lastIndexOf("/") + 1, featureLayer.url.length); hiddenFeatureLayerToSettingsName[featureLayer] = settingsKey; } } var settingsObject:Object = layerToSettings[settingsKey]; if (settingsObject) { var outFields:Array = settingsObject.outFields as Array; if (outFields && outFields.length) { var attributeInspectorFieldInspectors:Array = []; var fieldInspector:FieldInspector; for each (var fieldObject:Object in outFields) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = true; fieldInspector.fieldName = fieldObject.name; fieldInspector.label = fieldObject.alias; fieldInspector.toolTip = fieldObject.tooltip; attributeInspectorFieldInspectors.push(fieldInspector); } for each (var field:Field in featureLayer.layerDetails.fields) { if (outFields.indexOf(field.name) == -1) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = false; fieldInspector.fieldName = field.name; attributeInspectorFieldInspectors.push(fieldInspector); } } editor.attributeInspector.fieldInspectors = attributeInspectorFieldInspectors; editor.attributeInspector.formFieldsOrder = AttributeInspector.FIELD_INSPECTOR_ORDER; } else { var formFieldsOrder:String = settingsObject.formFieldsOrder; if (formFieldsOrder) { editor.attributeInspector.formFieldsOrder = formFieldsOrder; } } var singleToMultilineThreshold:Number = settingsObject.singleToMultilineThreshold; if (singleToMultilineThreshold && !isNaN(singleToMultilineThreshold)) { editor.attributeInspector.singleToMultilineThreshold = singleToMultilineThreshold; } var showObjectID:String = settingsObject.showObjectID; if (showObjectID) { editor.attributeInspector.showObjectID = showObjectID == "true"; } var showGlobalID:String = settingsObject.showGlobalID; if (showGlobalID) { editor.attributeInspector.showGlobalID = showGlobalID == "true"; } } } Hey Jason,
I noticed that this is an issue with the Edit Widget where the <formfieldsorder> is not being honored. Having looked at it in more detail and to be consistent with other widgets, i think it would make sense that if the fields are being specified explicitly in a certain order in the config, then there is no need to specify <formfieldsorder> as it would be redundant.
Here's the fix (if you are using the uncompiled version) for the EditWidget.mxml, replace the attributeInspector_showFeatureHandler() method with:private function attributeInspector_showFeatureHandler(event:AttributeInspectorEvent):void { attachmentInspector.addEnabled = editor.attributeInspector.updateEnabled; attachmentInspector.deleteEnabled = editor.attributeInspector.deleteButtonVisible; const featureLayer:FeatureLayer = event.featureLayer; var settingsKey:String = featureLayer.name; if (featureLayer.name.indexOf("hiddenLayer_") != -1) { settingsKey = hiddenFeatureLayerToSettingsName[featureLayer]; if (!settingsKey) { settingsKey = featureLayerToDynamicMapService[featureLayer].name + "/" + featureLayer.url.substring(featureLayer.url.lastIndexOf("/") + 1, featureLayer.url.length); hiddenFeatureLayerToSettingsName[featureLayer] = settingsKey; } } var settingsObject:Object = layerToSettings[settingsKey]; if (settingsObject) { var outFields:Array = settingsObject.outFields as Array; if (outFields && outFields.length) { var attributeInspectorFieldInspectors:Array = []; var fieldInspector:FieldInspector; for each (var fieldObject:Object in outFields) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = true; fieldInspector.fieldName = fieldObject.name; fieldInspector.label = fieldObject.alias; fieldInspector.toolTip = fieldObject.tooltip; attributeInspectorFieldInspectors.push(fieldInspector); } for each (var field:Field in featureLayer.layerDetails.fields) { if (outFields.indexOf(field.name) == -1) { fieldInspector = new FieldInspector; fieldInspector.featureLayer = featureLayer; fieldInspector.visible = false; fieldInspector.fieldName = field.name; attributeInspectorFieldInspectors.push(fieldInspector); } } editor.attributeInspector.fieldInspectors = attributeInspectorFieldInspectors; editor.attributeInspector.formFieldsOrder = AttributeInspector.FIELD_INSPECTOR_ORDER; } else { var formFieldsOrder:String = settingsObject.formFieldsOrder; if (formFieldsOrder) { editor.attributeInspector.formFieldsOrder = formFieldsOrder; } } var singleToMultilineThreshold:Number = settingsObject.singleToMultilineThreshold; if (singleToMultilineThreshold && !isNaN(singleToMultilineThreshold)) { editor.attributeInspector.singleToMultilineThreshold = singleToMultilineThreshold; } var showObjectID:String = settingsObject.showObjectID; if (showObjectID) { editor.attributeInspector.showObjectID = showObjectID == "true"; } var showGlobalID:String = settingsObject.showGlobalID; if (showGlobalID) { editor.attributeInspector.showGlobalID = showGlobalID == "true"; } } }
You would not have to set the <formfieldsorder> anymore with this update.
I have this same issue with the attribute table widget. I cannot get the field order for the widget to be honored.
<?xml version="1.0" ?> <configuration> <layersettings> <layer name="Incidents" > <columnsorder>alphabetical</columnsorder> </layer> </layersettings> </configuration>
<?xml version="1.0" ?> <configuration> <layersettings> <layer name="Delivery Point Additions"> <columnsorder>fields</columnsorder> <fields> <field name="DP_REQUEST_ID" alias="Request ID" visible="true"/> <field name="REQ_DATE_STR" alias="Request Date" visible="true"/> <field name="DP_NAM" alias="Name" visible="true"/> <field name="BUS_A" alias="Bus A" visible="true"/> <field name="BUS_B" alias="Bus B" visible="true"/> <field name="AQ_PROCESS_STATUS" alias="AQ Process Status" visible="true"/> <field name="TRANSMISSION_OWNER" alias="TO" visible="true"/> <field name="CUSTOMER" alias="Customer" visible="true"/> <field name="ASS_DUE_DATE_STR" alias="Assessment Due Date"/> <field name="ASS_COMP_DATE_STR" alias="Assessment Complete Date" visible="true"/> <field name="DPNS_STUDY_REQ" alias="DPNS Study Required" visible="true"/> <field name="DPNS_AGRMT_SENT_DATE_STR" alias="DPNS Agreement Sent Date" visible="true"/> <field name="DPNS_AGRMT_DUE_DATE_STR" alias="DPNS Agreement Due Date" visible="true"/> <field name="DPNS_AGRMT_RECIEVED_DATE_STR" alias="DPNS Agreement Recieved Date" visible="true"/> <field name="DEPOSIT_RECIEVED_DATE_STR" alias="Deposit Recieved Date" visible="true"/> <field name="DPNS_STUDY_DUE_DATE_STR" alias="DPNS Study Due Date" visible="true"/> <field name="DPNS_STUDY_FINISH_DATE_STR" alias="DPNS Study Finish Date" visible="true"/> <field name="NITSA_EXECUTION_DATE_STR" alias="NITSA Execution Date" visible="true"/> <field name="UPGRADE_ID" alias="Upgrade ID" visible="true"/> <field name="NTC_ID" alias="NTC ID" visible="true"/> <field name="VOLTAGE" alias="Voltage(kV)" visible="true"/> <field name="LOAD_MIN" alias="Load Min(MW)" visible="true"/> <field name="LOAD_MAX" alias="Load Max(MW)" visible="true"/> <field name="NOTES" alias="Notes" visible="true"/> </fields> <showobjectid>false</showobjectid> <showglobalid>false</showglobalid> <exportlocation>false</exportlocation> <showattachments>false</showattachments> <showrelatedrecords>false</showrelatedrecords> </layer> </layersettings> </configuration>
There were couple of changes made to the attribute table widget with regards to ordering.in upcoming release of 3.2. (The source code is available on git.)
1. The columnsorder tag now needs to be specified in the layer tag.
2. If the fields are specified in the layer tag of the attribute table, then Attribute table shows the fields in that order.
3. The default is the order of fields on the server side.
Sample config for the attribute table:
Here Incidents is the layer specie in the main config.
<?xml version="1.0" ?> <configuration> <layersettings> <layer name="Incidents" > <columnsorder>alphabetical</columnsorder> </layer> </layersettings> </configuration>
Hope this helps
<?xml version="1.0" ?> <configuration> <layersettings> <layer name="Surface USFWS"> <!-- type="feature" --> <columnsorder>fields</columnsorder> <fields> <field name="Refuge" alias="Refuge Name"/> <field name="NWR_Unit" alias="NWR Unit"/> <field name="LRS_Tract" alias="LRS Tract"/> <field name="OTYP" alias="Owner Code"/> <field name="OWNTYP" alias="Owner Type"/> <field name="Casetype" alias="Case Type"/> <field name="Surstat" alias="Surface Status"/> <field name="Serial_full" alias="Full Serial No."/> <field name="Cvyno" alias="Conveyance No."/> <field name="Cvydate" alias="Conveyance Date"/> <field name="Acres_LGL" alias="Acres (Legal)"/> <field name="Acres_GIS" alias="Acres (GIS)"/> <field name="USS" alias="USS No."/> <field name="Lot" alias="Lot No."/> <field name="Block" alias="Block No."/> <field name="Survey_Tract" alias="Survey Tract"/> <field name="Notes" alias="Notes"/> </fields> </layer> </layersettings> </configuration>
<map attributionvisible="true" esrilogovisible="true" openhandcursorvisible="false" scalebarvisible="true" scalebar="default" zoomslidervisible="false" wraparound180="true" addarcgisbasemaps="true" initialextent="-17927341.877726927 10083228.80475048 -17862599.714769468 10119918.578327317" wkid="102100" top="40" portalurl="https://www.arcgis.com"> <basemaps> <layer type="tiled" label="Topographic" icon="https://www.arcgis.com/sharing/rest/content/items/6e03e8c26aad4b9c92a87c1063ddb0e3/info/thumbnail/topo_map_2.jpg" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" visible="true"/> </basemaps> <operationallayers> <layer type="feature" label="Surface USFWS" url="http://myserver/arcgis/rest/services/Land_Status_Mapper/Land_Status/FeatureServer/0" mode="onDemand" visible="true"/> </operationallayers> </map>