Select to view content in your preferred language

Best way to prevent attribute editing via standard Pro UI

534
3
08-31-2023 03:32 AM
Asimov
by
New Contributor III

Hello, I'm working on a customization where all attribute editing is done through custom forms. I managed to setup a basic implementation of a workflow that opens a ProWindow to collect and validate all the attributes of a newly created feature that works well, which I'll extend to work with editing attributes of existing features. Now I need to find the right way to prevent users to edit data on the standard controls (e.g. attribute table; attributes pane).

What I'd like to accomplish is to be sure that the only way users have to edit data is through the custom controls we provide. As for my understanding (I'm new to Pro SDK development), there are several ways to accomplish this; I've came across and thought about a few ideas on the subject, like:

  • Hide and disable standard controls: this would lead to provide custom functionalities to replace them though, unless there is an easy way to just make them read-only
  • Turn off Editing and turn it on programmatically only when our custom workflow needs it (preventing it to be enabled by the user): this would need us to carefully manage start/stop editing sessions across the whole application
  • Let the user interact with standard controls and use OnRowChanged event (and/or other events) to validate data and act accordingly: this would mean that the event workflow can potentially grow a lot and become hard to maintain

I'm sure there are also other ways that I didn't think about. I mentioned the main pros and cons that came to my mind for each approach, but I'm aware they can be more. What I need to understand is which approach is the best choice, but so far I lack the experience to make an educated guess about it.

Is there any best practice around this subject that I can follow? If the approaches I mentioned are viable, which one of them is the most affordable, clean and correct? Is there any other way that I didn't think of?

Thanks in advance to anyone who will share their thought.

0 Kudos
3 Replies
CharlesMacleod
Esri Regular Contributor

The supported options for enabling/disabling editing are listed here:

https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#enable-and-disable-editing 

 

0 Kudos
Asimov
by
New Contributor III

Thanks @CharlesMacleod, I'm aware about the topics on the ProConcept page, I wasn't really looking for the code to enable/disable editing per se, but more for some higher level thought or best practice in order to implement the scenario I described.

Currently I implemented a solution where I manage the editability of layers turning it on and off depending on my needs. Basicly the addin sets them off on start and they stay off all the time, I turn on editing on any individual layer whenever my workflow needs to edit them, then I switch them off again. So far it seems like a robust enough solution and fairly scalable, I guess I'll see in the future if that leads to some serious issue.

0 Kudos
TimothySmith6
New Contributor III

We are using Edit Events   to listen for Create and Update row actions on layers.  If some criteria is not set you cancel/abort the edit.  You'll need to decide in your code which layers to register the events on, which was a change from ArcMap edit events.

We had several custom data entry forms in ArcMap as well, but we're moving away from them in Pro for out of the box editing.  We'll see how it goes.