import Workflow from "@arcgis/core/widgets/Editor/Workflow.js";const Workflow = await $arcgis.import("@arcgis/core/widgets/Editor/Workflow.js");- Inheritance:
- Workflow→
Accessor
- Subclasses:
- CreateFeaturesWorkflow, MergeFeaturesWorkflow, SplitFeatureWorkflow, UpdateFeaturesWorkflow, UpdateWorkflow
- Since
- ArcGIS Maps SDK for JavaScript 4.11
The read-only Workflow class helps manage different stages of an editing workflow.
A workflow can be thought of as one of two types: CreateFeaturesWorkflow and UpdateWorkflow.
If adding an individual or multiple features, the CreateFeaturesWorkflow is used. Whereas if editing an existing feature, the UpdateWorkflow is used.
Updating workflows include both editing geometry and attribute data and deleting features.
An instance of either a CreateFeaturesWorkflow or UpdateWorkflow
is accessed via the activeWorkflow property in either the Editor.activeWorkflow or EditorViewModel.activeWorkflow classes.
These workflows are only enabled if the feature service allows these operations. For example, if a feature service is only enabled to allow updates, it is not possible to override this using the API.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | WorkflowProperties<D, S> | | |
Properties
| Property | Type | Class |
|---|---|---|
data readonly | D | |
declaredClass readonly inherited | ||
hasNextStep readonly | | |
hasPreviousStep readonly | | |
started readonly | | |
stepId readonly | S | |
type readonly | "add-association" | "create-features" | "merge-features" | "split-feature" | "update" | "update-feature" | "update-features" | "update-table-record" | |
data
- Type
- D
The shared workflow data. This can be either CreateFeaturesWorkflowData, UpdateWorkflowData, UpdateFeaturesWorkflowData, MergeFeaturesWorkflowData, or SplitFeatureWorkflowData.
hasNextStep
- Type
- boolean
This property indicates whether there is a next step in the workflow.
hasPreviousStep
- Type
- boolean
This property indicates if there is a previous step in the workflow.
started
- Type
- boolean
Indicates whether the workflow is considered active.
- Default value
- false
type
- Type
- "add-association" | "create-features" | "merge-features" | "split-feature" | "update" | "update-feature" | "update-features" | "update-table-record"
Value indicating the workflow type.
| Possible Value | Description |
|---|---|
| create-features | This allows the end user to create either individual or continuous features in the feature service. (Since 4.23) |
| update | This allows the end user to update and/or delete features in the feature service. |
These workflows are only enabled if the feature service allows these operations.
Methods
| Method | Signature | Class |
|---|---|---|
cancel(options?: CancelWorkflowOptions): Promise<void> | | |
commit(): Promise<void> | | |
emit inherited | emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | |
hasEventListener inherited | hasEventListener<Type extends EventNames<this>>(type: Type): boolean | |
next(): Promise<void> | | |
on inherited | on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle | |
previous(options?: WorkflowPreviousOptions): Promise<void> | | |
reset(): Promise<void> | | |
start(): Promise<any> | |
emit
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
Example
view.on("click", function(event){ // event is the event handle returned after the event fires. console.log(event.mapPoint);});Type definitions
WorkflowPreviousOptions
cancelCurrentStep
- Type
- boolean
Cancels the current workflow when calling this method. Default value is false.