AnsweredAssumed Answered

attachmentlistmodel updateAttachmentWithIndex behaviour

Question asked by paul.haakma on Jul 21, 2020
Latest reply on Aug 5, 2020 by paul.haakma

Using the QML api, I get an ArcGISFeature which has an 'attachments' property which is an 'AttachmentListModel' which I then display in a listivew. The attachments (images in this use case) all display fine. I then include a button in the delegate to rotate the image. My function rotates the image, then updates the attachment model like so:


This works.


However, in the process, the rotated attachment gets removed from the model and appended to the end of it. I'm wondering if this is expected behaviour or not? Both methods do this.

In particular, the method that is called "...withIndex" implied to me that it would update the attachment at that index in place.

If there are a number of attachments, this has the effect that, when the user clicks the rotate button, the attachment seems to disappear and confuses the user.


The AttachmentListModel doesn't seem to have methods to insert at a particular index, or reorder the list, so currently the only workaround I can see is to NOT use the AttachmentListModel directly but instead copy everything over to a standard listmodel which I'd rather not do.


Any suggestions?