Hey everyone, I'm currently utilizing this library for sorting elements. I have a simple sortable setup where I'm trying to rearrange a three-element array by dragging. I can successfully change the positions, but the issue arises when my JSON array doesn't reflect the updated order.
This is what I'm doing:
My list:
<draggable v-model="getDocumentAttributes">
<div v-if="value.key != 'Document'" class="panel panel-primary" v-for="(value, key, index) in getDocumentAttributes">
<div class="panel-body quote">
<span @click="removeSection(index,key)" class="pull-right glyphicon glyphicon-remove text-info"></span>
<p>{{value.key}}</p>
</div>
</div>
</draggable>
My computed property that listens to Vuex getter:
getDocumentAttributes(){
return this.$store.getters.getDocumentAttributes;
}
Finally, here is my list and getter function on the Vuex side:
state: {
document: { "id": "0", "attributes": [] },
[...]
getDocumentAttributes: (state) => {
return state.document.attributes;
},