No @Filter Emit Event in TreeSelect #3238
Unanswered
sakal-viazul
asked this question in
PrimeVue
Replies: 1 comment
-
Looking for a solution for this too. For now I've used a hacky workaround, which (simplified) comes down to something like this: <script setup>
import { ref, computed } from 'vue';
const options = ref([
// etc.
])
const allIds = computed(() => [1, 2])
const expandedKeys = ref({})
function expandParents(e) {
if (e.target.value === '') {
expandedKeys.value = {}
return;
}
const selected = {}
allLedgerIds.value.forEach(id => {
selected[id] = true
})
expandedKeys.value = selected
}
</script>
<template>
<TreeSelect
:options="options"
filter
v-model:expanded-keys="expandedKeys"
:pt:pcTree:pcFilterInput:root:onInput="expandParents"
/>
</template>
It basically just marks every single node as expanded whenever someone filters something. When you clear out the filter it collapses all nodes. Having access to the filter event would simplify this a lot. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, Treeselect component doesn’t emit a @filter event when typing in the filter input. It’d be super helpful for my case which is to expand nodes based on filter input.
or does anyone have a workaround for this?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions