Select to view content in your preferred language

Add a button to the Relationship Inspector

545
0
12-11-2013 06:07 AM
ionarawilson1
Deactivated User
I really need  to have a button that goes to the last related record in the relationship inspector so the user does not need to click on one by one to get to the last. Would this be possible. I got a hold of the skin for the Relationship Inspector and for  the relationship inspector attribute inspector skin and I see it is using a previous record button and next record button but there is not a last record button. Would it be possible to create a button with a function that sends the user to the last record? thank you!

Here is the code for the relationship inspector skin where I think I could put another button to go to the last record, but I don't know how to code what goes inside the function to go to the last record:

<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (c) 2012 ESRI

    All rights reserved under the copyright laws of the United States
    and applicable international laws, treaties, and conventions.

    You may freely redistribute and use this sample code, with or
    without modification, provided you include the original copyright
    notice and use restrictions.

    See use restrictions in use_restrictions.txt.
-->
<!---
    The default skin class for the RelationshipInspector component.
    <p><b>Since:</b> ArcGIS API 3.1 for Flex</p>
-->
<s:SparkSkin 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">

    <!-- host component -->
    <fx:Metadata>
        /**
         * A strongly typed property that references the component to which this skin is applied.
         */
        [HostComponent("com.esri.ags.components.RelationshipInspector")]
    </fx:Metadata>

    <fx:Script>
        <![CDATA[
            import mx.events.EffectEvent;

            [Bindable]
            [Embed(source="S:/Sustainable Forestry/Iwilson/FEATURE_TABLE/src/assets/skins/loader.swf")]
            private var loader:Class;

            /* Define the symbol fill items that should be colored by the "symbolColor" style.*/
            private static const symbols:Array = [ "borderLineSymbol" ];

            /**
             * @private
             */
            override public function get symbolItems():Array
            {
                return symbols;
            }

            private function fade_effectEndHandler(event:EffectEvent):void
            {
                editOperationCompleteLabel.includeInLayout = false;
            }
        ]]>
    </fx:Script>

    <s:states>
        <s:State name="normal"/>
        <s:State name="disabled"/>
        <s:State name="queryRelatedRecords"/>
        <s:State name="addingNewRecord"/>
        <s:State name="noRelationships"/>
        <s:State name="noRelatedRecords"/>
    </s:states>

    <fx:Declarations>
        <s:Fade id="fade"
                alphaFrom="1"
                alphaTo="0"
                duration="1000"
                effectEnd="fade_effectEndHandler(event)"/>
        <fx:Component id="relationshipButton">
            <s:ToggleButton/>
        </fx:Component>
    </fx:Declarations>

    <s:Rect left="0" right="0" top="0" bottom="0"
            radiusX="5"
            radiusY="5">
        <s:stroke>
            <s:SolidColorStroke id="borderLineSymbol"
                                color="black"
                                weight="1"/>
        </s:stroke>
    </s:Rect>

    <!--- @private -->
    <mx:SWFLoader horizontalAlign="center"
                  horizontalCenter="0"
                  includeIn="queryRelatedRecords"
                  source="{loader}"
                  verticalCenter="0"/>

    <!--- @private -->
    <s:Label horizontalCenter="0"
             includeIn="noRelationships"
             text="{resourceManager.getString('ESRIMessages', 'relationshipInspectorNoRelationships')}"
             verticalCenter="0"/>

    <!--- @private -->
    <s:Label horizontalCenter="0"
             includeIn="noRelatedRecords"
             text="{resourceManager.getString('ESRIMessages', 'relationshipInspectorNoRelatedRecords')}"
             verticalCenter="0"/>

    <s:VGroup width="100%" height="100%"
              left="5" right="5" top="5" bottom="15"
              excludeFrom="noRelationships"
              horizontalAlign="right">
        <s:Scroller width="100%" verticalScrollPolicy="off">
            <s:HGroup id="relationshipButtonsGroup"
                      width="100%"
                      includeInLayout="false"
                      paddingBottom="5"
                      visible="false"/>
        </s:Scroller>
        <s:Button id="addRecordButton"
                  buttonMode="true"
                  excludeFrom="noRelationships,addingNewRecord"
                  includeInLayout="false"
      
                  label="{resourceManager.getString('ESRIMessages', 'relationshipInspectorAddRecord')}"
                  visible="false"/>
        <esri:AttributeInspector id="attributeInspector"
                                 width="100%" height="100%"
                                 deleteButtonLabel.addingNewRecord="{resourceManager.getString('ESRIMessages', 'relationshipInspectorCancel')}"
                                 excludeFrom="queryRelatedRecords,noRelationships,noRelatedRecords"
                                 okButtonLabel.addingNewRecord="{resourceManager.getString('ESRIMessages', 'relationshipInspectorAdd')}"
                                 okButtonVisible="{hostComponent.editEnabled &amp;&amp; hostComponent.featureLayer.isEditable}"
                                 updateEnabled="{hostComponent.editEnabled &amp;&amp; hostComponent.featureLayer.isEditable}"/>
    </s:VGroup>
    <s:HGroup id="editOperationStartGroup"
              width="100%"
              left="5" bottom="2"
              includeInLayout="false"
              verticalAlign="middle"
              visible="false">
        <mx:SWFLoader source="{loader}"/>
        <!--- Label shown when operation starts. -->
        <s:Label id="editOperationStartLabel" width="100%"/>
    </s:HGroup>
    <!--- Label shown when operation completes. -->
    <s:Label id="editOperationCompleteLabel"
             width="100%"
             left="5" bottom="2"
             hideEffect="{fade}"
             includeInLayout="false"
             visible="false"/>

</s:SparkSkin>

Tags (2)
0 Kudos
0 Replies