Skip to content

Commit

Permalink
Fix order by .order instead of index
Browse files Browse the repository at this point in the history
  • Loading branch information
caleeli committed Feb 27, 2024
1 parent 1efc46d commit 86c37ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/sortable/Sortable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default {
data() {
return {
search: "",
filteredItems: this.items,
filteredItems: [...this.items],
};
},
watch: {
Expand All @@ -56,7 +56,7 @@ export default {
},
items: {
handler(newItems) {
this.filteredItems = newItems;
this.filteredItems = [...newItems];
if (this.search.length > 0) {
this.filteredItems = this.filterItems(this.search, newItems);
Expand Down
2 changes: 1 addition & 1 deletion src/components/sortable/sortableList/SortableList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default {
// get the order of the dragged over item
const tempOrder = this.itemsClone[draggedOverItemIndex].order;
// set the increment
const increment = draggedItemIndex > draggedOverItemIndex ? 1 : -1;
const increment = this.draggedItem > this.draggedOverItem ? 1 : -1;
// update the order of the items between the dragged item and the dragged over item
if (draggedItemIndex < draggedOverItemIndex) {
Expand Down
5 changes: 1 addition & 4 deletions src/components/vue-form-builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@
@item-edit="() => {}"
@item-delete="confirmDelete"
@add-page="$bvModal.show('addPageModal')"
@ordered="orderPages"
/>
</b-modal>

Expand Down Expand Up @@ -1348,9 +1347,7 @@ export default {
this.updateState();
this.inspect(clone);
},
orderPages(items) {
this.config = [...items];
}

}
};
</script>
Expand Down

0 comments on commit 86c37ed

Please sign in to comment.