fix column filter not working

This commit is contained in:
Adrian Zürcher
2025-12-10 14:07:57 +01:00
parent 6f7f969c49
commit 8bb8293047

View File

@@ -26,7 +26,10 @@
</q-card> </q-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import { computed, ref, watch } from 'vue';
// initialized only after first mount
const isMounted = ref(false);
const props = defineProps({ const props = defineProps({
columnFilter: String, columnFilter: String,
@@ -42,6 +45,18 @@ const columnFilter = computed({
set: (v) => emit('update:columnFilter', v), set: (v) => emit('update:columnFilter', v),
}); });
//reset column option
watch(
() => props.columnFilter,
() => {
if (!isMounted.value) {
isMounted.value = true;
return;
}
emit('update:columnOption', []); // reset properly
},
);
const columnOption = computed({ const columnOption = computed({
get: () => props.columnOption, get: () => props.columnOption,
set: (v) => emit('update:columnOption', v), set: (v) => emit('update:columnOption', v),