PortalItemCommentListModel QML Type
Represents the list of comments relating to a PortalItem. More...
Import Statement: | import Esri.ArcGISRuntime 100.10 |
Since: | Esri.ArcGISRuntime 100.0 |
Properties
Signals
- countChanged()
- errorChanged()
- portalItemCommentAdded(int index)
- portalItemCommentRemoved(int index)
Methods
- bool contains(PortalItemComment portalItemComment)
- void forEach(callback)
- PortalItemComment get(int index)
- int indexOf(PortalItemComment portalItemComment)
Detailed Description
Comments can be retrieved by calling fetchComments on a PortalItem and accessed via the {PortalItem::comments} {comments} method after the task is complete.
The model returns data for the following roles:
Role | Type | Description |
---|---|---|
comment | string | The text of the comment. |
commentId | string | The ID of the comment. |
created | date | The date the comment was created. |
owner | string | The username of the user that added the comment. |
Example:
Accessing various roles of the model from within a QML delegate:
Text{
anchors.fill: parent
// acccess the comment, commentId, created and owner roles of the model
text: "comment:" + comment + "; ID:" + commentId + "; created:" + created + "; owner: " + owner
wrapMode: Text.WrapAnywhere
}
See also PortalUser, PortalItemComment, and PortalItem.
Property Documentation
error : Error |
Returns the error (if any) that occurred (read-only).
Signal Documentation
Emitted when the count
property of the model changes.
Note: The corresponding handler is onCountChanged
.
Signal emitted when the error
property changes, which can indicate that an error occurred.
Note: The corresponding handler is onErrorChanged
.
Signal emitted when a comment is added to the model. index The index at which the PortalItemComment was added.
Note: The corresponding handler is onPortalItemCommentAdded
.
Signal emitted when a comment is removed from the model. index The index at which the PortalItemComment was removed.
Note: The corresponding handler is onPortalItemCommentRemoved
.
Method Documentation
bool contains(PortalItemComment portalItemComment) |
Returns true
if the list model contains the specified portalItemComment.
Receives a callback function to execute for each portalItemComment in the model.
The callback function can take 0 to 3 optional arguments, in order:
- element Current portalItemComment.
- index Current index in array.
- array Reference to PortalItemCommentListModel.
Returns undefined if no error occurred, and an error message otherwise.
var error = PortalItemCommentListModel.forEach(function(element, index, array) {
...
});
if (error) {
console.error(error.message);
}
PortalItemComment get(int index) |
Returns the PortalItemComment at the specified index.
int indexOf(PortalItemComment portalItemComment) |
Returns the index of a specific portal item comment (portalItemComment) from the list model.
This method was introduced in Esri::ArcGISRuntime 100.5..