Does the SelectButton provide a select event listener?

UI Components for Vue
Post Reply
jtuchel
Posts: 4
Joined: 16 Oct 2021, 11:16

23 Oct 2021, 14:55

I'm using Vue3 and would like to know if the **SelectButton** component provides any "change" events to retrieve the selected item. I wasn't able to find any in the docs

https://primefaces.org/primevue/showcase/#/selectbutton

I expect the model value as a prop and want to emit the selected value back to the parent component.

Code: Select all

<template>
  <p-select-button
    :modelValue="modelValue"
    :options="options"
  />
  <!-- Lacks change event handler -->
</template>
 
<script lang="ts">
import { defineComponent, ref } from "vue";
 
export default defineComponent({
  props: {
    modelValue: String,
  },
  setup() {
    const options = ref(['On', 'Off']);
 
    // Lacks change event handler to emit event to parent component
 
    return { options };
  },
});
</script>
How do I subscribe to the new value to pass it back to the parent component?

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

12 Nov 2021, 15:11

'change' event added for the next version. https://github.com/primefaces/primevue/issues/1748

Until then you could use 'update:modelValue' event that returns only the selected value.

Thanks for the great feedback!

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests