AttachmentListModel QML Type

A list model storing a list of Attachments available for an ArcGISFeature. More...

Import Statement: import Esri.ArcGISRuntime 100.15
Since: Esri.ArcGISRuntime 100.0

Properties

Signals

Methods

Detailed Description

Note: You cannot declare or create a component of this type in QML code.

Modifying this model (adding, updating, or deleting) will update the attachments that belong to the corresponding ArcGISFeature.

By default, attachment edits will be automatically applied back to the server if the ArcGIS feature belongs to a ServiceFeatureTable. Attachments will also automatically be fetched each time an attachment edit operation completes. This class contains properties to change this default behavior.

The model returns data for the following roles:

RoleTypeDescription
namestringThe name of the attachment.
contentTypestringThe MIME type of the attachment file.
dataFetchedboolWhether the attachment data has already been retrieved.
sizestringThe size of the attachment in bytes.
attachmentUrlurlThe URL of the attachment.
attachmentIdstringThe ID of the attachment (since Esri.ArcGISRuntime 100.1)

See also Cancelable, autofetchAttachments, and autoApplyEdits.

Property Documentation

addAttachmentStatus : Enums.TaskStatus

The status for the task to add an attachment.

See also Enums.TaskStatus.


autoApplyEdits : bool

Returns whether the model will automatically apply attachment edits back to the server.

By default, automatically applying attachment edits is enabled. Only applicable if the model is bound to a ServiceFeatureTable.


autofetchAttachments : bool

Whether the model will automatically fetch attachments after an attachment edit operation completes.

  • autoFetchAttachments - Whether to fetch attachments automatically. The default value is true.

When instantiated, the model always fetches attachments. This setting only limits subsequent attachment fetches.


count : int

Returns the number of rows in the model (read-only).


deleteAttachmentStatus : Enums.TaskStatus

The status for the task to delete an attachment.

See also Enums.TaskStatus.


deleteAttachmentsStatus : Enums.TaskStatus

The status for the task to delete multiple attachments.

See also Enums.TaskStatus.


error : Error

Returns the Error object (read-only).


fetchAttachmentsStatus : Enums.TaskStatus

The status for the task to fetch Attachments.

See also Enums.TaskStatus.


updateAttachmentStatus : Enums.TaskStatus

The status for the task to update an attachment.

See also Enums.TaskStatus.


Signal Documentation

addAttachmentStatusChanged()

Emitted when the addAttachmentStatus property changes.

Note: The corresponding handler is onAddAttachmentStatusChanged.


autoApplyEditsChanged()

Emitted when the autoApplyEdits property changes.

Note: The corresponding handler is onAutoApplyEditsChanged.


autofetchAttachmentsChanged()

Emitted when the autofetchAttachments property changes.

Note: The corresponding handler is onAutofetchAttachmentsChanged.


countChanged()

Emitted when the count property changes.

Note: The corresponding handler is onCountChanged.


deleteAttachmentStatusChanged()

Emitted when the deleteAttachmentStatus property changes.

Note: The corresponding handler is onDeleteAttachmentStatusChanged.


deleteAttachmentsStatusChanged()

Emitted when the deleteAttachmentsStatus property changes.

Note: The corresponding handler is onDeleteAttachmentsStatusChanged.


errorChanged()

Emitted when the error property changes, which can indicate that an error occurred.

Note: The corresponding handler is onErrorChanged.


fetchAttachmentsStatusChanged()

Emitted when the fetchAttachmentsStatus property changes.

Note: The corresponding handler is onFetchAttachmentsStatusChanged.


updateAttachmentStatusChanged()

Emitted when the updateAttachmentStatus property changes.

Note: The corresponding handler is onUpdateAttachmentStatusChanged.


Method Documentation

string addAttachment(url file, string contentType, string name)

Adds a new feature attachment.

  • file - The file to read that contains the attachment data.
  • contentType - The MIME type of the new attachment.
  • name - The name to give the new attachment.

If file does not exist, the attachment is added without data.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to addAttachment. You should check that the addAttachmentStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal addAttachmentStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the addAttachment task.

See also Cancelable.


string deleteAttachment(Attachment attachment)

Deletes a feature attachment.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to deleteAttachment or deleteAttachmentWithIndex. You should check that the deleteAttachmentStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal deleteAttachmentStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the deleteAttachment task.

See also Cancelable.


string deleteAttachmentWithIndex(int index)

Deletes a feature attachment at the given index in the model.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to deleteAttachment or deleteAttachmentWithIndex. You should check that the deleteAttachmentStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal deleteAttachmentStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the deleteAttachmentWithIndex task.

See also Cancelable.


string deleteAttachments(list<Attachment> attachments)

Deletes a list of feature attachments.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to deleteAttachments or deleteAttachmentsWithIndex. You should check that the deleteAttachmentsStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal deleteAttachmentsStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the deleteAttachments task.

See also Cancelable.


string deleteAttachmentsWithIndex(int index, int count)

Deletes feature attachments starting at index in the model and deleting count attachments.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to deleteAttachments or deleteAttachmentsWithIndex. You should check that the deleteAttachmentsStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal deleteAttachmentsStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the deleteAttachmentsWithIndex task.

See also Cancelable.


string fetchAttachments()

Fetches attachments for the attachment in the model.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to fetchAttachments. You should check that the fetchAttachmentsStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal fetchAttachmentsStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the fetchAttachments task.

See also Cancelable.


error forEach(callback)

Receives a callback function to execute for each attachment in the model.

The callback function can take 0 to 3 optional arguments, in order:

  • element Current attachment.
  • index Current index in array.
  • array Reference to AttachmentListModel.

Returns undefined if no error occurred, and an error message otherwise.

const error = attachmentListModel.forEach(function(element, index, array) {
    ...
});
if (error) {
    console.error(error.message);
}

Attachment get(int index)

Gets the Attachment at a given index in the model.


string updateAttachment(Attachment attachment, url file, string contentType, string name)

Updates a feature attachment.

  • attachment - The Attachment describing the attachment to update.
  • file - The file to read that contains the attachment data.
  • contentType - The MIME type of the attachment.
  • name - The name to give the attachment.

If file does not exist, the attachment's data is removed.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to updateAttachment or updateAttachmentWithIndex. You should check that the updateAttachmentStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal updateAttachmentStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the updateAttachment task.

See also Cancelable.


string updateAttachmentWithIndex(int index, url file, string contentType, string name)

Updates a feature attachment referenced at a given index in the model.

  • index The index in the model.
  • file The file to read that contains the attachment data.
  • contentType The MIME type of the attachment.
  • name The name to give the attachment.

If file does not exist, the attachment's data is removed.

This method uses an asynchronous task that cannot be started if it is already running from a previous call to updateAttachment or updateAttachmentWithIndex. You should check that the updateAttachmentStatus property is not Enums.TaskStatusInProgress before calling this method.

After the task starts, you may use the signal updateAttachmentStatusChanged to monitor task status.

Returns a task ID that can be used to cancel the updateAttachmentWithIndex task.

See also Cancelable.


Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.