From 9775c6b0c6e956ff6bdf11edb03615210d9e71d6 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Fri, 12 Aug 2022 22:22:41 +0200 Subject: [PATCH] Changed pisition handling. --- src/views/List.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/views/List.vue b/src/views/List.vue index 136f9f0..ebd9657 100644 --- a/src/views/List.vue +++ b/src/views/List.vue @@ -26,7 +26,7 @@ +
+ +
@@ -56,6 +59,8 @@ export default { listName: '', searchQ: '', searchResults: [], + uncheckedItems: [], + checkedItems: [], initialItems: [], loading: true, addModalShown: false, @@ -114,23 +119,20 @@ export default { }) }, recopyItemsObject: function () { - this.searchResults = this.initialItems.map(x => ({...x})); + this.uncheckedItems = this.initialItems.filter(x => !x.checked).map(x => ({...x})); + this.checkedItems = this.initialItems.filter(x => x.checked).map(x => ({...x})); }, searchItem: function (e) { if (e.key === 'Enter') { this.createItem(); } else { if (this.searchQ.length > 0) { - this.searchResults = this.searchResults.filter(i => i.content.toLowerCase().indexOf(this.searchQ.toLowerCase()) >= 0) + this.searchResults = this.initialItems.filter(i => i.content.toLowerCase().indexOf(this.searchQ.toLowerCase()) >= 0) } else { this.recopyItemsObject(); } } }, - addItem: function (item) { - this.initialItems.push(item); - this.recopyItemsObject(); - }, onChange: function (event) { if (event.moved) { this.updateItem({