primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.84k stars 1.24k forks source link

PickList selection props doesnt work (as expected) #6811

Closed aisiklar closed 5 days ago

aisiklar commented 6 days ago

Describe the bug

in ver.3.53 PickList component, "selection" props/api doesn't produce the expected result. Maybe I am using it wrong?

Check the stackblitz link please.

Reproducer

https://stackblitz.com/edit/fqk33q-5qp44b?file=src%2FApp.vue

PrimeVue version

3.53.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

please go to stackblitz and run the code.

Expected behavior

I was expecting a change in the "selected" ref value upon selecting any item from the picklist component (therefore get into watcher function and log the new value. ) Thanks

aisiklar commented 5 days ago

Ok, I found out how to do this.

Closing this issue.

For those that might want to know about how I solved, I added v-model: before "selection" props.

before (doesn't work):

 <PickList
      v-model="products"
      selection="selected"
      listStyle="height:342px"
      dataKey="id"
      breakpoint="1400px"
    >

after (works):

<PickList
      v-model="products"
      v-model:selection="selected"
      listStyle="height:342px"
      dataKey="id"
      breakpoint="1400px"
    >