Easiest way to customize AttributeInspector associated with an active Editor

3449
14
12-22-2010 12:46 PM
RoyceSimpson
Occasional Contributor III
I've got an app with Editor and default AttributeInspector but would like to basically do what this Attribute Inspector (edit) sample does in terms of a custom AttributeInspector.  However, the sample only updates existing features and isn't wired to an Editor. 

Is there a way to simply point existing Editor to a custom AttributeInspector?

I would like to remove (or possibly just disable) a couple fields from the Attribute Inspector and populate those programatically when a new feature is created or when an existing feature is updated.
Tags (2)
0 Kudos
14 Replies
RoyceSimpson
Occasional Contributor III
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']  = ...


I'm not using secured services or any secure login mechanism at this point.  What I am doing though, is... upon app load, the user is presented with a "login" form:  First Name, Last name, agency, phone number, email address, etc...  This info is then stored as a Flash cookie locally on their machine for quick login on subsequent sessions.  The info is also sent back to an SDE table along with a boolean value for "isLoggedIn" and "isAway".  These values are updated for that record every time the user leaves the page and/or kills the app.  I then have a listView that the users can bring up in the app which shows who's logged in and whether they are "away" or not.  When a user has this listView up, the sde table is queried every 10 seconds for records that have "isLoggedIn==true" and updates the listView.  If "isAway==true" the listItem value becomes italicized.  The user can hover over the list items and get detailed info about other "logged in users" via a tooltip. 

By the same token, whenever a user adds, updates features, this info (user name), is programatically used as the value for the "EDITEDBY" field.

The downside to this is... as mentioned at the top of this post... it isn't secure.  The site I have running this stuff is in prototype form and has yet to move forward with the next (security) steps.
0 Kudos
juan_isaacloya_garcia
New Contributor
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..
0 Kudos
RoyceSimpson
Occasional Contributor III
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..


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];
0 Kudos
juan_isaacloya_garcia
New Contributor
i have this error:
"1120: Access of undefined property _currentEditor."
i thik i was doing all bad...

this is my code:
<fx:Script>
        <![CDATA[
              .
              .
              .
              public var usuario:String =FlexGlobals.topLevelApplication.parameters.usuario;
              public var fl:FeatureLayer = _currentEditor.featureLayers[0];
.
.
.
   private function editsStartingHandler(event:FeatureLayerEvent):void
   {
    if (event.adds)
    {
     event.adds[0].attributes['USUARIO']  = usuario;
    }
   }

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];
0 Kudos
SimonRoss_User
Occasional Contributor
Thanks for all of the useful information on this old thread - it has really helped progress a current project despite the age of the original post.

I'm hoping to extend this approach a little further and have a couple of additional issues we're currently trying to resolve

1.  We've been able to populate fields with pre-defined values but these do not appear in the attribtue inspector when it opens, closing the inspector and reopening it then shows the values.  We've tried both selection complete and edits starting and get the same behaviour

2.  We'd like to extend the validation of fields to compare values between fields.  For example we need the end date to alwasy be greater than the start date.  I can see a way to do this working with a completely custom attribute inspector but would like to do this with the default attribute inspector associated with the editor.  Any thoughts on the best approach for this would be welcome

Thanks in advance
0 Kudos